pub fn spectral_radius(graph: &Graph) -> IgraphResult<f64>Expand description
Compute the spectral radius of a graph.
ρ(G) = max_i |λ_i| — the largest eigenvalue in absolute value.
For undirected graphs, this equals λ_1 (the largest eigenvalue).
Returns 0.0 for an empty graph.
§Examples
use rust_igraph::{Graph, spectral_radius};
// K_3: eigenvalues {2, -1, -1} → spectral radius = 2
let g = Graph::from_edges(&[(0,1),(1,2),(0,2)], false, Some(3)).unwrap();
let rho = spectral_radius(&g).unwrap();
assert!((rho - 2.0).abs() < 0.01);