pub fn degree_spectral_gap_estimate(graph: &Graph) -> IgraphResult<f64>Expand description
Compute the degree-based spectral gap estimate.
(d_max - d_second) / d_max where d_max is the maximum degree
and d_second is the second-largest degree. This is a rough proxy
for the spectral gap (difference between the two largest eigenvalues
of the adjacency matrix). Returns 0.0 for graphs with fewer than 2
vertices or where max degree is 0.
§Examples
use rust_igraph::{Graph, degree_spectral_gap_estimate};
// Star S_5: max_deg=4, second=1 → (4-1)/4 = 0.75
let g = Graph::from_edges(&[(0,1),(0,2),(0,3),(0,4)], false, Some(5)).unwrap();
assert!((degree_spectral_gap_estimate(&g).unwrap() - 0.75).abs() < 1e-10);