pub fn articulation_points<G>(graph: G) -> Vec<G::NodeId>where
    G: IntoNodeIdentifiers + IntoNeighbors + NodeIndexable,
Expand description

Find all articulation points in a simple undirected graph.

In a graph, a vertex is called an articulation point if removing it and all the edges associated with it results in the increase of the number of connected components in the graph.

Returns the vector of G::NodeID.

Examples

use graphalgs::connect::articulation_points;
use petgraph::graph::UnGraph;

// Create the following graph:
// 0----1    4
//      | __/|
// 5----2/---3

let mut g = UnGraph::new_undirected();
let n0 = g.add_node(());
let n1 = g.add_node(());
let n2 = g.add_node(());
let n3 = g.add_node(());
let n4 = g.add_node(());
let n5 = g.add_node(());
g.add_edge(n0, n1, ());
g.add_edge(n1, n2, ());
g.add_edge(n2, n3, ());
g.add_edge(n3, n4, ());
g.add_edge(n2, n4, ());
g.add_edge(n5, n2, ());

// The articulation points of this graph are vertices 1 and 2.
assert_eq!(articulation_points(&g), vec![n2, n1]);