Skip to contents

Compute the Euclidean distance of adjacency spectral embeddings

Usage

dist_ASE(A, d = 2)

Arguments

A

An \(n \times n\) adjacency matrix

d

dimension of the latent space embed in

Value

An \(n \times n\) matrix \(D\), where \(D_{i,j}\) represents the distance between nodes \(v_i\) and \(v_j\).

Details

For adjacency matrix \(\boldsymbol{A}\) with \(n\) nodes, let \(\hat{\boldsymbol{\Lambda}} \in \mathbb{R}^{d \times d}\) be the diagonal matrix formed by the top d largest-magnitude eigenvalues of the adjacency matrix and \(\hat{\boldsymbol{U}} \in \mathbb{R}^{n \times d}\) be the matrix with the corresponding eigenvectors as its columns. The adjacency spectral embedding of \(\boldsymbol{A}\) is \(\hat{\boldsymbol{X}} = \hat{\boldsymbol{U}}\hat{\boldsymbol{\Lambda}}^{1/2} \in \mathbb{R}^{n \times d}\).

Then, \(D_{i,j}\) is the Euclidean norm of \(\hat{\boldsymbol{X}}_{i, \cdot}\) and \(\hat{\boldsymbol{X}}_{j, \cdot}\).

Examples

library(JaB)
library(igraph)
data("paul.revere")

A <- as_adjacency_matrix(paul.revere, sparse = FALSE)
D <- dist_ASE(A)