pub fn kirchhoff_index(graph: &Graph) -> IgraphResult<f64>Expand description
Compute the Kirchhoff index of a graph.
Kf(G) = Σ_{u<v} R(u,v) = n · Σ_{i≥2} 1/λ_i
where λ_i are the non-zero Laplacian eigenvalues.
The Kirchhoff index measures the overall resistance of the network.
§Examples
use rust_igraph::{Graph, kirchhoff_index};
// Path 0-1-2: R(0,1)=1, R(0,2)=2, R(1,2)=1 → Kf = 4
let g = Graph::from_edges(&[(0,1),(1,2)], false, Some(3)).unwrap();
let kf = kirchhoff_index(&g).unwrap();
assert!((kf - 4.0).abs() < 0.01);