Skip to main content

articulation_ratio

Function articulation_ratio 

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

Compute the articulation ratio.

Fraction of vertices that are articulation points (cut vertices whose removal disconnects the graph). Uses a DFS-based algorithm in O(V+E). Returns 0.0 for graphs with fewer than 3 vertices or no edges.

§Examples

use rust_igraph::{Graph, articulation_ratio};

// Path 0-1-2: vertex 1 is the only cut vertex → 1/3
let g = Graph::from_edges(&[(0,1),(1,2)], false, Some(3)).unwrap();
assert!((articulation_ratio(&g).unwrap() - 1.0/3.0).abs() < 1e-10);