pub fn bridges<G>(graph: G) -> Vec<(G::NodeId, G::NodeId)>
where
    G: IntoNodeIdentifiers + IntoNeighbors + NodeIndexable,
{
    let mut bridges = Vec::new();
    let mut visited = vec![false; graph.node_bound()];
    let mut tin = vec![0usize; graph.node_bound()];
    let mut fup = vec![0usize; graph.node_bound()];
    let mut timer = 0usize;

    for start in 0..graph.node_bound() {
        if !visited[start] {
            bridges_dfs_helper(
                graph,
                start,
                graph.node_bound() + 1,
                &mut bridges,
                &mut visited,
                &mut timer,
                &mut tin,
                &mut fup,
            );
        }
    }

    bridges
}
/// Find all [bridges](https://en.wikipedia.org/wiki/Bridge_(graph_theory)) in a simple undirected graph.
///
/// Returns the vector of pairs `(G::NodeID, G:: NodeID)`,
/// representing the edges of the input graph that are bridges.
/// The order of the vertices in the pair and the order of the edges themselves are arbitrary.
///
/// # Examples
///
/// ```
/// use petgraph::algo::bridges;
/// 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 bridges in this graph are the undirected edges {2, 5}, {1, 2}, {0, 1}.
/// assert_eq!(bridges(&g), vec![(n2, n5), (n1, n2), (n0, n1)]);
/// ```
Find all [bridges]) in a simple undirected graph.
Returns the vector of pairs `(G::NodeID, G:: NodeID)`,
representing the edges of the input graph that are bridges.
The order of the vertices in the pair and the order of the edges themselves are arbitrary.
Find all [ bridges ] ) in a simple undirected graph . Returns the vector of pairs ` ( G :: NodeID G :: NodeID ) ` representing the edges of the input graph that are bridges . The order of the vertices in the pair and the order of the edges themselves are arbitrary .
pub fn bridges<G>(graph: G) -> Vec<(G::NodeId, G::NodeId)>
where
    G: IntoNodeIdentifiers + IntoNeighbors + NodeIndexable,
{
    let mut bridges = Vec::new();
    let mut visited = vec![false; graph.node_bound()];
    let mut tin = vec![0usize; graph.node_bound()];
    let mut fup = vec![0usize; graph.node_bound()];
    let mut timer = 0usize;
    for start in 0..graph.node_bound() {
        if !visited[start] {
            bridges_dfs_helper(
                graph,
                start,
                graph.node_bound() + 1,
                &mut bridges,
                &mut visited,
                &mut timer,
                &mut tin,
                &mut fup,
            );
        }
    }
    bridges
}
pub fn bridges < G > ( graph : G ) -> Vec < ( G :: NodeId , G :: NodeId ) > where G : IntoNodeIdentifiers + IntoNeighbors + NodeIndexable , { let mut bridges = Vec :: new ( ) ; let mut visited = vec ! [ false graph node_bound ( ) ] ; let mut tin = vec ! [ 0usize graph node_bound ( ) ] ; let mut fup = vec ! [ 0usize graph node_bound ( ) ] ; let mut timer = 0usize ; for start in 0 .. graph . node_bound ( ) { if ! visited [ start ] { bridges_dfs_helper ( graph , start , graph . node_bound ( ) + 1 , & mut bridges , & mut visited , & mut timer , & mut tin , & mut fup , ) ; } } bridges }
Find all [bridges](https://en.wikipedia.org/wiki/Bridge_(graph_theory)) in a simple undirected graph.
Find all [ bridges ] ( https : // en . wikipedia . org / wiki / Bridge_ ( graph_theory )) in a simple undirected graph .
graph
G
examples
```
use petgraph::algo::bridges;
use petgraph::graph::UnGraph.





The bridges in this graph are the undirected edges {2, 5}, {1, 2}, {0, 1}.
` ` ` use petgraph :: algo :: bridges ; use petgraph :: graph :: UnGraph . The bridges in this graph are the undirected edges { 2 5 } { 1 2 } { 0 1 } .