Bridges, Articulation Points & Biconnectivity
Low-link values and the edges whose removal disconnects a graph.
Cut one cable and half the network goes dark: that cable is a bridge, and a router whose failure splits the network is an articulation point. Testing every edge separately takes time. One depth-first search finds them all in , by computing a single number per vertex: how high in the DFS tree its subtree can climb.
What you’ll learn
- Define bridges, articulation points, 2-edge-connected and biconnected components, and low-link values on a DFS tree.
- Prove the bridge criterion and the articulation-point criteria, and implement both in , parallel edges included.
- Find the biconnected components with an edge stack, and build the bridge tree and the block-cut tree.
- Prove Robbins's theorem on one-way streets with a DFS orientation, and place these algorithms among parallel and dynamic connectivity results.
Cut edges, cut vertices and the DFS tree
The obvious algorithm deletes each edge in turn and runs a BFS: time. Depth-first search does better because of a fact from the Optimized lesson: in an undirected DFS every edge is a tree edge or a back edge, so every non-tree edge joins a vertex to one of its ancestors. Removing a tree edge , with the parent, cuts off the subtree , and the graph stays connected exactly when some back edge leaves and lands above .
| Vertex | Parent | Why | ||
|---|---|---|---|---|
| A | — | 1 | 1 | the root |
| B | A | 2 | 1 | its child C reaches A |
| C | B | 3 | 1 | back edge C–A |
| D | C | 4 | 4 | its subtree reaches no higher than D |
| E | D | 5 | 4 | its child F reaches D |
| F | E | 6 | 4 | back edge F–D |
| G | F | 7 | 7 | a leaf with no back edge |
The two criteria, proved
Non-tree edges lie on cycles. A back edge joins to its ancestor , so with the tree path from down to it closes a cycle, and an edge on a cycle is not a bridge:
Which edges leave a subtree. Delete the tree edge . Any other edge with exactly one end in is a back edge from some to a proper ancestor of , because non-tree edges join ancestors and descendants. Proper ancestors of are discovered no later than , and vertices of no earlier than , so such an edge exists if and only if
Articulation points. Delete a non-root . The rest of the tree outside stays connected through 's parent, and the subtrees of 's children are joined by no edge, since there are no cross edges. The subtree of a child stays attached exactly when a back edge leaves it for a proper ancestor of , that is, when ; a back edge landing on itself vanishes with . So is a cut vertex if and only if
The root. Its children's subtrees are joined by no edge, again because there are no cross edges, so deleting the root separates them exactly when there are at least two. With one child, everything else lies in that child's subtree, which stays connected.
In the running example, the tree edges with are C–D () and F–G (): the two bridges. The articulation points are C (child D: ), D (child E: ) and F (child G: ). B fails the test (), and the root A has a single child.
import sys
def bridges_and_cut_vertices(n, edges):
"""edges: (u, v) pairs, parallel edges allowed. Returns (bridge indices, cut vertices)."""
sys.setrecursionlimit(10_000 + 2 * n)
adj = [[] for _ in range(n)]
for i, (u, v) in enumerate(edges):
adj[u].append((v, i))
adj[v].append((u, i))
disc, low = [0] * n, [0] * n
bridges, cut = [], set()
clock = 0
def dfs(u, parent_edge):
nonlocal clock
clock += 1
disc[u] = low[u] = clock
children = 0
for v, i in adj[u]:
if i == parent_edge:
continue # skip the edge we came in on, not the parent vertex
if disc[v]:
low[u] = min(low[u], disc[v]) # back edge
else:
children += 1
dfs(v, i)
low[u] = min(low[u], low[v])
if low[v] > disc[u]:
bridges.append(i) # v's subtree cannot climb above v
if parent_edge != -1 and low[v] >= disc[u]:
cut.add(u) # v's subtree cannot climb above u
if parent_edge == -1 and children >= 2:
cut.add(u) # a root with two or more children
for s in range(n):
if not disc[s]:
dfs(s, -1)
return bridges, sorted(cut)One DFS, time. Skipping the arrival edge by its index makes a parallel edge to the parent count as a back edge, so a doubled edge is correctly not a bridge. On the running example (vertices A–G numbered 0–6) it returns the edges F–G and C–D and the cut vertices C, D and F. For inputs with very long paths, prefer an explicit stack or C++.
For a tree edge , with not the root, the DFS finds . Which statement is right?
- is a bridge and is an articulation point
- is a bridge, but is not an articulation point
- is not a bridge, but is an articulation point
- is not a bridge, and is not an articulation point
Show the answer
C. is not a bridge, but is an articulation point
means that the best back edge out of lands exactly on . That edge keeps attached when the edge is removed, so it is no bridge; but it disappears when itself is removed, so falls off and is a cut vertex. In the running example, D with its child E is this case: .
Blocks, the block-cut tree and one-way streets
Bridges split a graph into 2-edge-connected components: delete every bridge, and the pieces that remain are the maximal subgraphs without a bridge of their own. Contract each piece to a single vertex and the bridges become the edges of a forest, the bridge tree, which is a tree when is connected (a cycle in it would put a bridge on a cycle of ). In the running example the pieces are {A, B, C}, {D, E, F} and {G}, joined in a path by C–D and F–G.
Articulation points split the edges instead. Call two edges equivalent when they are equal or lie on a common simple cycle; the classes are the biconnected components, or blocks. A bridge is a block by itself, two blocks share at most one vertex, and a vertex lies in two or more blocks exactly when it is an articulation point. The running example has four blocks: the triangle A–B–C, the edge C–D, the triangle D–E–F and the edge F–G.
The block-cut tree has a node for every block and a node for every articulation point, with an edge from each articulation point to each block containing it. For a connected graph it is a tree, and it turns questions about separation into questions about tree paths: when , every path from to passes through the articulation point exactly when lies on the tree path between the nodes of and (a vertex's node is its block, or itself if it is an articulation point). With binary lifting on that tree (see the lesson Lowest Common Ancestors), each such query takes time.
A bridge defeats every orientation. It is the only link between its two sides, so whichever way it points, the side it points into can never get back.
Orient along a DFS. Run a DFS from any vertex ; direct each tree edge from parent to child and each back edge from descendant to ancestor. The root reaches every vertex along tree edges:
Every vertex climbs back to the root. Induct on . For with parent , the edge is not a bridge, so : some has a back edge to a vertex with . Walk down tree edges from to , cross to , and finish by induction, since :
Every vertex reaches and reaches every vertex, so the orientation is strongly connected, and it was built in time.
Which connected graph has no bridge but does have an articulation point?
- A path on four vertices
- A cycle on five vertices
- Two triangles joined by one extra edge
- Two triangles that share one vertex
Show the answer
D. Two triangles that share one vertex
In this "bowtie" every edge lies on a triangle, so none is a bridge, yet deleting the shared vertex leaves two separate pieces. It is 2-edge-connected but not biconnected, and its blocks are the two triangles. The reverse cannot happen: if a connected graph with at least three vertices has a bridge, at least one end of the bridge is an articulation point.
Beyond two: connectivity at larger scale
Bridges and articulation points are the case of a general notion. A graph is -vertex-connected if it has more than vertices and stays connected after deleting any of them, and -edge-connected if it stays connected after deleting any edges. Menger's theorem (1927) turns separators into paths: the fewest vertices whose removal separates two non-adjacent vertices and equals the largest number of – paths that share no inner vertex, and the same holds for edges and edge-disjoint paths. For it gives Whitney's characterization: a graph with at least three vertices is biconnected exactly when every two of its vertices lie on a common cycle.
Depth-first search goes further than . Hopcroft and Tarjan (1973) also split a biconnected graph into its triconnected components in linear time; the published algorithm contained errors, which Gutwenger and Mutzel corrected in 2001, and it underlies the SPQR trees used in planarity testing and graph drawing. Schmidt (2013) found a much simpler certifying test, a chain decomposition of a DFS into paths and cycles from which both 2-edge- and 2-vertex-connectivity can be read off in .
In directed graphs the analogues are strong bridges and strong articulation points, whose removal increases the number of strongly connected components. Low-links no longer suffice, but the dominator trees of the graph and of its reverse do, and Italiano, Laura and Santaroni (2012) find all of them in linear time.
When the graph changes, recomputing from scratch costs per update. Holm, de Lichtenberg and Thorup (2001) maintain connectivity under edge insertions and deletions in amortized time per update, 2-edge connectivity in and biconnectivity in , all deterministically.
Key takeaways
- In an undirected DFS every non-tree edge joins a vertex to an ancestor, so removing a tree edge or a vertex cuts off a subtree exactly when no back edge climbs out of it far enough.
- With the earliest discovery time reachable from through one back edge: is a bridge iff ; a non-root is an articulation point iff some child has ; the root iff it has two or more children.
- One DFS with an edge stack yields every biconnected component in . Contracting the 2-edge-connected components gives the bridge tree, and blocks with cut vertices form the block-cut tree.
- A connected graph can be oriented to be strongly connected exactly when it has no bridge (Robbins, 1939), and a DFS builds such an orientation in linear time.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
A bridge-finding DFS skips every edge that leads back to the parent vertex. On a graph whose only edges are two parallel edges between and , what does it report?
- No bridge, which is correct
- One of the two edges as a bridge, although neither is one
- Both edges as bridges
- as an articulation point
Show the answer
B. One of the two edges as a bridge, although neither is one
DFS from crosses the first edge to . At the second edge also leads to the parent vertex , so it is skipped too, stays , and the first edge is reported. Skipping only the index of the arrival edge treats the parallel edge as a back edge and gives the right answer: the two edges form a cycle.
The root of a DFS tree has exactly one child. Is it an articulation point?
- Yes, whenever its degree is at least 2
- Only if the low-link of its child equals 1
- No: every other vertex lies in the child's subtree, which stays connected without the root
- Yes, always: the search started there
Show the answer
C. No: every other vertex lies in the child's subtree, which stays connected without the root
All other vertices are descendants of the single child , and is held together by tree edges that avoid the root. Extra edges at the root are back edges into , which change nothing. The test holds for every child of the root, which is why the root needs its own rule.
A connected road network has exactly one bridge. Can every road be made one-way so that every intersection can still reach every other one?
- No: whichever way the bridge points, one side can never reach the other
- Yes: orient the tree edges of a DFS downward and the back edges upward
- Yes, provided the network has an even number of roads
- Only if the bridge's two ends both have degree at least 3
Show the answer
A. No: whichever way the bridge points, one side can never reach the other
A bridge is the only link between its two sides, so once it points one way, nothing can come back. Robbins's theorem says that this is the only obstacle: without bridges, the DFS orientation is strongly connected.
When the DFS returns from a child to its parent and finds , it pops edges from the edge stack down to and including . What do the popped edges form?
- All the edges of the subtree
- One biconnected component, the block that contains
- One 2-edge-connected component
- A simple cycle through
Show the answer
B. One biconnected component, the block that contains
Every block nested deeper in was popped earlier, when the search returned through its own articulation point. The edges still above are those of the block containing , and since that block cannot reach above . A bridge comes out as a block of one edge.
Further reading
- J. Hopcroft & R. E. Tarjan, "Algorithm 447: Efficient algorithms for graph manipulation," Communications of the ACM 16(6) (1973), 372–378.
- R. E. Tarjan, "A note on finding the bridges of a graph," Information Processing Letters 2(6) (1974), 160–161.
- H. E. Robbins, "A theorem on graphs, with an application to a problem of traffic control," American Mathematical Monthly 46(5) (1939), 281–283.
- J. Holm, K. de Lichtenberg & M. Thorup, "Poly-logarithmic deterministic fully-dynamic algorithms for connectivity, minimum spanning tree, 2-edge, and biconnectivity," Journal of the ACM 48(4) (2001), 723–760.
- S. Even, Graph Algorithms, 2nd ed., edited by G. Even (Cambridge University Press, 2011), the chapter "Depth-First Search".