Note: a bridge is a cut edge

Using DFS

We first run the classical dfs algorithm (red edges and numbers)

Definition: The low number (blue numbers) of a vertex , denoted as , is the smallest DFS number (the red numbers) reachable from by following:

  • Any number of tree edges downward in the DFS tree (red edges).
  • At most one back edge (grey edges).

Formally,


Two Cases for Cut Vertices

1. is not the root of the DFS tree

Vertex is a cut vertex if and only if it has a child in the DFS tree such that:

2. is the root of the DFS tree

The root is a cut vertex if and only if it has at least two children in the DFS tree. This is because:

  • If the root has only one child, removing the root does not disconnect the remaining subtree.
  • If the root has multiple children, their subtrees become separate connected components when the root is removed.

It’s easy to see that if , then there could not exist a back edge from green (the bottom three) to brown vertices. If , then there is a back edge from green (the bottom three) to , in which case, is still a cut vertex.


Bridges

Let be a tree edge in the DFS tree, with being the parent of . Then is a bridge if and only if:

can easily be checked by the graph above.