pub fn degree_leaf_ratio(graph: &Graph) -> IgraphResult<f64>Expand description
Compute the leaf ratio (fraction of degree-1 vertices).
Returns the fraction of vertices with degree exactly 1 (pendants). Returns 0.0 for empty graphs.
§Examples
use rust_igraph::{Graph, degree_leaf_ratio};
// Star S_5: 4 leaves out of 5 → 0.8
let g = Graph::from_edges(&[(0,1),(0,2),(0,3),(0,4)], false, Some(5)).unwrap();
assert!((degree_leaf_ratio(&g).unwrap() - 0.8).abs() < 1e-10);