Interactive Graph Theory Learning
Interactive Graph Theory Learning
Guest User
Using app without sign in
Cut-edge (bridge) finder
Finds edges whose removal increases connected components
Select an algorithm and generate steps to begin visualization
A bridge (or cut edge) is an edge whose removal disconnects the graph. Bridge finding locates the critical links of a network, the connections with no alternative route.
A single depth-first search assigns discovery times and low-link values. An edge (u, v), where v is a DFS child of u, is a bridge exactly when low[v] > disc[u], meaning nothing in the subtree of v links back to u or above. All bridges are found in O(V + E) time. The same DFS skeleton also yields articulation points, and contracting the 2-edge-connected components produces the bridge tree of the graph.
Bridges reveal critical fiber links in telecom backbones, indispensable roads and rail segments, and fragile connections in power grids. In software, bridge analysis helps assess API dependency risk. LeetCode features it as the well-known critical connections problem.
Identical machinery to articulation points, with one comparison changed from >= to strictly greater than.
dfs(u, parent):
disc[u] = low[u] = ++time
for each neighbor v of u:
if v == parent: continue // skip the edge we came on
if v is visited:
low[u] = min(low[u], disc[v]) // back edge
else:
dfs(v, u)
low[u] = min(low[u], low[v])
if low[v] > disc[u]:
report edge (u, v) as a bridgeThe strict inequality is the whole difference from articulation points. low[v] > disc[u] says nothing in the subtree below v can reach u or anything above it, so the edge (u, v) is the only route and removing it disconnects the graph. Articulation points use low[v] >= disc[u], where equality means the subtree can reach u itself but no further, which strands the subtree if you delete the vertex u but not if you delete the single edge.
Run the DFS from A on a triangle with a two-edge tail, the same graph used for articulation points, so the two tests can be compared on identical data.
Example graph: Undirected edges A-B, B-C and C-A forming a triangle, plus C-D and D-E.
The bridges are C-D and D-E. Note the contrast with articulation points on this identical graph, where the answer was the vertices C and D. Every edge of the triangle lies on a cycle and so has a detour, while every edge of the tail is the sole connection to what lies beyond it. The general rule falls out directly: an edge is a bridge exactly when it lies on no cycle.
Time: O(V + E) · Space: O(V)
One depth-first search with constant extra work per edge, so the cost is that of the traversal. Each vertex is visited once and each edge examined twice, once from each endpoint. The state is two integers per vertex plus the recursion stack, all O(V). The naive approach of removing each edge and testing connectivity costs O(E·(V + E)), so on a graph with 10,000 edges the low-link method is roughly four orders of magnitude faster.
The same DFS answers several related questions. Pick by whether the fragile thing is an edge, a vertex, or a whole region.
| Alternative | Prefer it when | Cost |
|---|---|---|
| Articulation points | The critical thing is a vertex rather than a link. Same DFS with low[v] >= disc[u]. | O(V + E) |
| Bridge tree / 2-edge-connected components | You want the regions that survive any single edge failure, not just the fragile edges. | O(V + E) |
| Union-Find on non-bridge edges | You want to contract each 2-edge-connected component into a single node. | O(E·α(V)) |
| Min-cut | Edges have capacities and you want the cheapest disconnecting set, not the single-edge failures. | max-flow cost |
Read the full article: Applications of Graph Theory in the Real World
Related algorithms: Articulation Points, Depth-First Search