Data Structures · Visualization
Graph: Articulation Points & Bridges
Graph
An articulation point (cut vertex) is a vertex whose removal disconnects the graph; a bridge is an edge whose removal does the same. Time: O(V + E). Space: O(V) for discovery/low-link arrays plus O(V) recursion stack.
Big-O: BFS/DFS visit each vertex and edge once: O(V + E).
Graph: Articulation Points & Bridges
GraphAn articulation point (cut vertex) is a vertex whose removal disconnects the graph; a bridge is an edge whose removal does the same. Both are found in one DFS pass by tracking each vertex's discovery time and the lowest discovery time reachable via back edges ('low-link value').
How Articulation Points & Bridges Works
- Run DFS, recording each vertex's discovery time and initializing its low-link value to the same.
- For each DFS tree edge (u→v), after recursing into v, update low[u] = min(low[u], low[v]).
- For each back edge (u→w, w already visited and not u's parent), update low[u] = min(low[u], disc[w]).
- An edge (u→v) is a bridge if low[v] > disc[u] (v's subtree has no back edge to u or above).
- A non-root vertex u is an articulation point if some child v has low[v] >= disc[u]; the root is an articulation point if it has more than one DFS child.
Articulation Points & Bridges Worked Example
Input: Graph: 0-1, 1-2, 2-0, 1-3, 3-4
- DFS from 0: disc/low = {0:0,1:1,2:2,3:3,4:4} initially
- 2's only path back is via the 0-1-2 cycle, so low[2]=0, low[1]=0 (via the back edge 2→0)
- Edge 1-3: low[3]=3, and 3 > disc[1]=1, so 1-3 is a bridge; vertex 1 is an articulation point
- Edge 3-4: low[4]=4 > disc[3]=3, so 3-4 is also a bridge; vertex 3 is an articulation point
Output: Bridges: (1,3) and (3,4); Articulation points: 1 and 3
Press â–¶ Run to watch it step by step.
def find_bridges(adj):
n = len(adj)
tin = [0] * n
low = [0] * n
visited = [False] * n
timer = 0
bridges = []
def dfs(u, parent):
nonlocal timer
timer += 1
tin[u] = low[u] = timer
visited[u] = True
for v in adj[u]:
if v == parent:
continue
if visited[v]:
low[u] = min(low[u], tin[v]) # back edge
else:
dfs(v, u)
low[u] = min(low[u], low[v])
if low[v] > tin[u]: # no detour above u
bridges.append((u, v))
for u in range(n):
if not visited[u]:
dfs(u, -1)
return bridges
# example: bridgesBehind the Scenes Execution
Press ▶ Run in the visualizer — the call stack, registers and memory will replay here in sync with the code, line by line.
Articulation Points & Bridges Time & Space Complexity
When to Use Articulation Points & Bridges
- Network reliability analysis (single points of failure)
- Road network critical-junction identification
- Circuit design fault-tolerance checks
Recommended resourcesAffiliate links · may earn us a commission
Recommended for learners
Ready for the next step?
See the same ideas in action — visualize the algorithms that operate on these structures, or take a guided course.