pub fn eigen_adjacency(
graph: &Graph,
nev: usize,
which: EigenWhich,
) -> IgraphResult<EigenDecomposition>Expand description
Compute selected eigenvalues of a graph’s adjacency matrix.
For undirected graphs, the adjacency matrix is real symmetric and the
eigenvalues are real. For directed graphs, the matrix-vector product
uses the symmetrized adjacency (A + A^T) / 2 so that the Lanczos
solver applies; the eigenvalues correspond to this symmetrized form.
§Arguments
graph— the graph whose adjacency spectrum to computenev— number of eigenvalues to compute (clamped tovcount)which— which part of the spectrum to target
§Errors
Returns IgraphError::InvalidArgument if the graph has zero vertices.
§Examples
use rust_igraph::{Graph, eigen_adjacency, EigenWhich};
let mut g = Graph::with_vertices(4);
g.add_edge(0, 1).unwrap();
g.add_edge(1, 2).unwrap();
g.add_edge(2, 3).unwrap();
g.add_edge(3, 0).unwrap();
let result = eigen_adjacency(&g, 2, EigenWhich::LargestAlgebraic).unwrap();
assert_eq!(result.eigenvalues.len(), 2);