Embed a Connected Graph Using its Positive Laplacian Spectrum
Source:R/graph_embedding_spectrum.R
graph.spectral.embedding.RdEmbed a Connected Graph Using its Positive Laplacian Spectrum
Usage
graph.spectral.embedding(spectrum, dim = 2, scale = c("none", "inverse.sqrt"))Arguments
- spectrum
A
graph_spectrumobject returned bygraph.spectrum().- dim
Positive integer number of coordinates, no greater than the number of positive eigenpairs in
spectrum.- scale
Coordinate scaling:
"none"uses the orthonormal eigenvectors;"inverse.sqrt"divides each column by the square root of its eigenvalue.
Value
Numeric matrix with one row per vertex and columns Dim1, Dim2,
and so on. Columns use the smallest dim positive eigenvalues.
Details
The spectrum object carries the eigenvalue ordering, zero-mode tolerance
and component information, so embedding never discards a column by position
in an arbitrary eigenvector matrix. Disconnected graphs are rejected:
embed each component separately with create.subgraph() and
graph.spectrum(). There is no implied distance between separate components.
Singleton and empty graphs have no positive-dimensional spectral embedding.
Unscaled coordinates are a spectral representation, not original physical coordinates. On a connected graph, inverse-square-root scaling using all positive modes makes squared Euclidean distances equal to effective resistance; using fewer modes gives a truncated representation. Neither choice generally reproduces shortest-path or manifold geodesic distances. Signs and bases within tied eigenvalues can vary; choose whole tied eigenspaces when comparing embedding distances across backends.
Examples
graph <- create.graph("chain", 8)
spectrum <- graph.spectrum(graph, nev = 3)
graph.spectral.embedding(spectrum, dim = 2)
#> Dim1 Dim2
#> [1,] -0.49039264 0.4619398
#> [2,] -0.41573481 0.1913417
#> [3,] -0.27778512 -0.1913417
#> [4,] -0.09754516 -0.4619398
#> [5,] 0.09754516 -0.4619398
#> [6,] 0.27778512 -0.1913417
#> [7,] 0.41573481 0.1913417
#> [8,] 0.49039264 0.4619398
graph.spectral.embedding(spectrum, dim = 3, scale = "inverse.sqrt")
#> Dim1 Dim2 Dim3
#> [1,] -1.2568349 0.6035534 -0.37415144
#> [2,] -1.0654932 0.2500000 0.08778833
#> [3,] -0.7119398 -0.2500000 0.44134172
#> [4,] -0.2500000 -0.6035534 0.25000000
#> [5,] 0.2500000 -0.6035534 -0.25000000
#> [6,] 0.7119398 -0.2500000 -0.44134172
#> [7,] 1.0654932 0.2500000 -0.08778833
#> [8,] 1.2568349 0.6035534 0.37415144