Graph Theory37 sections · 1633 units
Open in Course

Tarjan's Algorithm for Bridges

(One-pass DFS solution)

Tarjan's algorithm finds all bridges in O(V+E)O(V+E) time using a single DFS traversal. The idea: run DFS, compute disc[v] and low[v] for each vertex. An edge (u,v)(u, v) is a bridge if low[v] > disc[u]. Why?

If low[v] > disc[u], then the subtree rooted at vv cannot reach any vertex discovered before uu or even uu itself. The edge (u,v)(u, v) is the only connection. Remove it, and the subtree becomes isolated.

Space complexity is O(V)O(V) for the data structures used.