pub fn collatz_sinogowitz(graph: &Graph) -> IgraphResult<f64>Expand description
Compute the Collatz–Sinogowitz irregularity.
CS(G) = ρ(A) - 2m/n
where ρ(A) is the spectral radius (largest eigenvalue of the
adjacency matrix) and 2m/n is the average degree. Always ≥ 0 by
the Perron-Frobenius theorem for connected graphs.
Returns 0.0 for empty graphs (0 vertices or 0 edges).
§Examples
use rust_igraph::{Graph, collatz_sinogowitz};
// K_3: spectral radius = 2, avg degree = 2, CS = 0
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
assert!(collatz_sinogowitz(&g).unwrap().abs() < 1e-10);