Short answer: A bridge of an undirected graph is an edge whose removal increases the number of connected components. An articulation point is a vertex with the same effect. One depth-first search computes a discovery time and a low value, the oldest discovery time reachable from the subtree by tree edges and back edges. A tree edge is a bridge when the child’s low value stays above the parent’s discovery time. The scan is Θ(V+E).
What the problem actually asks
Deleting a random edge or vertex and rechecking connectivity is correct and far too slow. The depth-first tree of an undirected connected graph has a simple separation property: a subtree hangs off its parent by one tree edge, and every other edge out of the subtree is a back edge to an ancestor. If none of those back edges reaches the parent or above, the tree edge is the only connection, so it is a bridge.
A vertex is an articulation point for a different comparison. The root is one when it has two or more tree-children. Any other vertex u is one when some child subtree cannot reach above u, because then u separates that subtree from the rest of the graph.
What the algorithm guarantees
On an undirected graph the algorithm lists every bridge and every articulation point in Θ(V+E) time. Low[v] is the minimum of v’s discovery time, the low values of its children, and the discovery times of vertices reached by a back edge from v. The parent edge is not a back edge. Treating it as one makes low[v] see the parent and hides every bridge.
A tree edge u–v, with v the child, is a bridge when low[v] > disc[u]. The vertex u is an articulation point when it is the root and has two tree-children, or when it is not the root and some child v has low[v] ≥ disc[u]. The non-strict comparison for vertices is the one that catches a subtree that can return to u and no higher. The strict comparison for edges is the one that catches a subtree that cannot return even to u.
The working steps
- Run depth-first search on each component. Stamp discovery times as vertices are entered. Initialize low to the discovery time.
- For each neighbor, skip nothing except the edge back to the parent. A neighbor that is an ancestor updates low by a minimum with that ancestor’s discovery time.
- A neighbor that is undiscovered is a tree child. Recurse, then minimize low with the child’s low.
- After the child returns, if low[child] > disc[u], the tree edge is a bridge. If u is not the root and low[child] ≥ disc[u], u is an articulation point.
- After the root’s adjacency list is scanned, the root is an articulation point when it grew at least two tree-children.
The comparisons are for an undirected graph. A directed graph’s strong connectivity is a different partition, computed by Tarjan’s strongly connected components or by Kosaraju, and a directed bridge is defined on the condensation. Parallel undirected edges are not bridges, because the second edge still connects the endpoints. The parent-edge skip has to skip one adjacency entry, not every edge to the parent’s name, when parallel edges exist.
Approaches that look simpler and fail
| Approach | Why it fails when the parent edge is treated as a back edge |
|---|---|
| Minimize low with the parent | The subtree appears able to climb out through the same tree edge it came in on. Real bridges are missed. |
| Use ≥ for a bridge | A subtree that can climb exactly to the parent is still separated from the parent’s ancestors if it cannot climb higher. The edge to the parent is a bridge only when the climb fails entirely, which is the strict test. |
| Use > for an articulation point | A child that can reach u and not the ancestors above u is separated from the rest of the graph by u. The non-strict test is the one that marks u. |
| Run the undirected algorithm on directed edges | Directed reachability is not symmetric. Strong components are the directed notion of “no single edge is the whole story,” and they need the directed algorithm. |
Strongly connected components of a directed graph belong to Tarjan’s other algorithm or to Kosaraju. A minimum cut of edge capacity, rather than a bridge of connectivity, belongs to a flow algorithm or to Stoer-Wagner.
A working example
This Python fragment marks a tree edge as a bridge when the child’s low-link is strictly greater than the parent’s discovery time. The edge 1—2 is the only bridge of a triangle 0-1-2 with an extra edge 1-3? Here the graph is a triangle plus a pendant: 2—3 is the bridge. It prints 2 3.
adj = {0: [1, 2], 1: [0, 2], 2: [0, 1, 3], 3: [2]}
disc = [-1] * 4
low = [-1] * 4
time = 0
bridges = []
def dfs(u, parent):
global time
disc[u] = low[u] = time
time += 1
for v in adj[u]:
if v == parent:
continue
if disc[v] < 0:
dfs(v, u)
low[u] = min(low[u], low[v])
if low[v] > disc[u]:
bridges.append((u, v))
else:
low[u] = min(low[u], disc[v])
dfs(0, -1)
assert bridges == [(2, 3)]
print(*bridges[0])
Where it is used
Tarjan’s bridge and articulation-point algorithm finds the links and the routers whose removal disconnects a network. Network-vulnerability scans ask exactly that. A minimum cut can be a set of several edges; a bridge is a single edge.
When you can drop this algorithm
Drop the search when the graph is directed. Use a strong-component algorithm. Keep this low-value scan for undirected bridges and articulation points, and keep the parent edge out of the back-edge update.
Why this stays published
We publish this so a search for bridges and articulation points returns the two different comparisons, strict for edges and non-strict for vertices. One undirected depth-first search finds every bridge and articulation point from subtree low values, using a strict test for tree edges and a non-strict test for vertices.
本文由 HoHo 與 AI 協作整理,最後更新於 2026 年 11 月 13 日。
