Skip to main content

algebraic_connectivity

Function algebraic_connectivity 

Source
pub fn algebraic_connectivity(graph: &Graph) -> IgraphResult<f64>
Expand description

Compute the algebraic connectivity of a graph.

a(G) = λ_2(L) — the second-smallest eigenvalue of the Laplacian. Returns 0.0 for disconnected graphs and single-vertex graphs.

For undirected graphs only.

§Examples

use rust_igraph::{Graph, algebraic_connectivity};

// K_3: Laplacian eigenvalues {0, 3, 3} → a(G) = 3
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
let a = algebraic_connectivity(&g).unwrap();
assert!((a - 3.0).abs() < 0.01);