nd.extremal {NetworkDistance} | R Documentation |
Extremal distance with top-k
eigenvalues
Description
Extremal distance (nd.extremal
) is a type of spectral distance measures on two graphs' graph Laplacian,
L := D-A
where A
is an adjacency matrix and D_{ii}=\sum_j A_{ij}
. It takes top-k
eigenvalues from
graph Laplacian matrices and take normalized sum of squared differences as metric. Note that it is
1. non-negative, 2. separated, 3. symmetric, and satisfies 4. triangle inequality in that
it is indeed a metric.
Usage
nd.extremal(A, out.dist = TRUE, k = ceiling(nrow(A)/5))
Arguments
A |
a list of length |
out.dist |
a logical; |
k |
the number of largest eigenvalues to be used. |
Value
a named list containing
- D
an
(N\times N)
matrix ordist
object containing pairwise distance measures.- spectra
an
(N\times k)
matrix where each row is top-k
Laplacian eigenvalues.
References
Jakobson D, Rivin I (2002). “Extremal metrics on graphs I.” Forum Mathematicum, 14(1). ISSN 0933-7741, 1435-5337.
Examples
## load data
data(graph20)
## compute distance matrix
output = nd.extremal(graph20, out.dist=FALSE, k=2)
## visualize
opar = par(no.readonly=TRUE)
par(pty="s")
image(output$D[,20:1], main="two group case", col=gray(0:32/32), axes=FALSE)
par(opar)