Skip to main content

pendant_edge_ratio

Function pendant_edge_ratio 

Source
pub fn pendant_edge_ratio(graph: &Graph) -> IgraphResult<f64>
Expand description

Compute the pendant edge ratio.

Fraction of edges that are incident to at least one degree-1 vertex. A pendant edge connects a leaf to the rest of the graph. Returns 0.0 for graphs with no edges.

§Examples

use rust_igraph::{Graph, pendant_edge_ratio};

// Star S_5: all 4 edges are pendant → 1.0
let g = Graph::from_edges(&[(0,1),(0,2),(0,3),(0,4)], false, Some(5)).unwrap();
assert!((pendant_edge_ratio(&g).unwrap() - 1.0).abs() < 1e-10);