Given an undirected graph with V vertices (0 .. V-1) and edges edges (no self-loops or duplicate edges), return all articulation points (cut vertices) — vertices whose removal increases the number of connected components — in ascending order.
Input: V = 5, edges = [[0,1],[1,2],[2,0],[1,3],[3,4]] Output: [1, 3] Removing 1 splits the triangle from the tail; removing 3 isolates 4.
Input: V = 4, edges = [[0,1],[1,2],[2,3],[3,0]] Output: [] A single cycle has no cut vertices.
- 1 <= V <= 10^5 - 0 <= edges.length <= 10^5 - no self-loops or duplicate edges
An articulation point is a vertex the graph can't afford to lose without falling apart. Tarjan's algorithm finds them in one DFS with the same disc/low machinery as bridges:
disc[u] — discovery time; low[u] — earliest discovery time reachable from u's subtree via one back edge.u is an articulation point iff some child v has low[v] ≥ disc[u]: v's subtree cannot reach above u, so removing u cuts it off. (Note ≥, not the strict > used for bridges.)O(V + E). The brute force removes each vertex and recounts components (O(V · (V + E))).
“What's an articulation point?”
A vertex whose removal increases the number of components.
“Output order?”
Ascending.
I DFS with disc/low; a non-root u is a cut vertex if some child's low is ≥ disc[u], and the root is one if it has two or more DFS children.
The ≥ (vs the bridge's strict >) captures that the child can reach back only as high as u, not above.
Worked example — V = 5, edges [[0,1],[1,2],[2,0],[1,3],[3,4]]
1 connects the triangle {0,1,2} to the tail 3-4 -> removing 1 splits them -> articulation
3 connects to leaf 4 -> removing 3 isolates 4 -> articulation
answer = [1, 3]
The child subtree can't bypass u.
It joins otherwise-separate subtrees.
Articulation points use the non-strict test.
| Remove each vertex | Tarjan (disc/low) | |
|---|---|---|
| Idea | recount components without it | one DFS with low-links |
| Time | O(V·(V+E)) | O(V+E) |
| Condition | component count increases | low[v] ≥ disc[u] (or root child-count) |
Both find the same cut vertices. Full code is in the Approaches selector below.
Key takeaway
An articulation point's removal disconnects the graph. Tarjan: a non-root u is one iff a child has low[v] ≥ disc[u]; the root iff it has ≥ 2 DFS children. O(V+E).
non-root u: some child v with low[v] >= disc[u] root u: DFS child count >= 2