pub fn natural_connectivity(graph: &Graph) -> IgraphResult<f64>Expand description
Compute the natural connectivity of a graph.
λ̄ = ln(EE(G) / n) = ln((1/n) Σ_i exp(λ_i))
A robust measure of network structural redundancy / fault tolerance. Higher values indicate more alternative paths.
Returns 0.0 if the graph has no vertices.
§Examples
use rust_igraph::{Graph, natural_connectivity};
// K_3: EE = e² + 2e⁻¹ → λ̄ = ln(EE/3)
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
let nc = natural_connectivity(&g).unwrap();
let expected = ((2.0_f64).exp() + 2.0 * (-1.0_f64).exp()).ln() - (3.0_f64).ln();
assert!((nc - expected).abs() < 0.01);