Learn R Programming

gasper (version 1.1.6)

spectral_coords: Spectral Coordinates for Graph Drawing

Description

Calculates the spectral coordinates of a graph using the two smallest non-zero eigenvalues of the graph Laplacian.

Usage

spectral_coords(adj_mat)

Value

A matrix where each row represents the spectral coordinates of a node in the graph.

Arguments

adj_mat

A symmetric adjacency matrix or sparse matrix representing an undirected graph.

Details

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.

References

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.

See Also

plot_graph, plot_signal

Examples

Run this code
if (FALSE) {
matrixname <- "bcspwr02"
groupname <- "HB"
download_graph(matrixname,groupname)
xy <- spectral_coords(bcspwr02$sA)
bcspwr02$xy <- xy
plot_graph(bcspwr02)
}

Run the code above in your browser using DataLab