View source: R/spectral_coords.R
spectral_coords | R Documentation |
Calculates the spectral coordinates of a graph using the two smallest non-zero eigenvalues of the graph Laplacian.
spectral_coords(adj_mat)
adj_mat |
A symmetric adjacency matrix or sparse matrix representing an undirected graph. |
The spectral_coords
function implements a 2-dimensional spectral graph drawing method based on the eigenvectors of the graph Laplacian associated with its two smallest non-zero eigenvalues. Given a graph with adjacency matrix adj_mat
, the graph Laplacian L
is computed, which is a matrix representation that encodes the graph's topology. The Laplacian's eigenvalues and eigenvectors are calculated, and the eigenvectors corresponding to the second and third non-zero smallest eigenvalues are used to determine the coordinates of the graph's vertices in the plane.
A matrix where each row represents the spectral coordinates of a node in the graph.
Chung, F. R. K. (1997). Spectral Graph Theory. American Mathematical Soc.
Hall, K. M. (1970). An r-dimensional quadratic placement algorithm. Management science, 17(3), 219-229.
plot_graph
, plot_signal
## Not run:
matrixname <- "bcspwr02"
groupname <- "HB"
download_graph(matrixname,groupname)
xy <- spectral_coords(bcspwr02$sA)
bcspwr02$xy <- xy
plot_graph(bcspwr02)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.