Articulation Points and Bridges
An articulation point is a vertex, and a bridge an edge, whose removal disconnects an undirected graph. One depth-first search with discovery times and low values finds all of them in O(V + E).
Cut Vertices and Cut Edges
An articulation point in a graph (also called a cut vertex) is a vertex of a connected undirected graph whose removal, together with its edges, disconnects the graph. A bridge (also called a cut edge or isthmus) is an edge whose removal disconnects it. For a graph that is already split, the definition becomes: removal increases the number of connected components.
In the graph above, removing vertex 1 separates {2, 3} from the rest, so 1 is an articulation point. Removing edge 6 – 7 leaves 7 on its own, so 6 – 7 is a bridge. Vertex 4 is not an articulation point: without it, 0 and 5 are still joined directly.
- Defined for undirected graphs; the directed analogue is strongly connected components
- A graph with no articulation point is biconnected; one with no bridge is 2-edge-connected
- An edge on a cycle is never a bridge: the rest of the cycle is a second route
- An endpoint of a bridge is a cut vertex unless it has degree 1
Brute Force: Remove and Recount
The definition gives a direct algorithm. For each vertex, delete it, count the connected components with BFS or DFS, and compare with the original count. Do the same for each edge. Each count costs O(V + E), so checking every vertex costs O(V · (V + E)) and every edge O(E · (V + E)).
That is fine for a few hundred vertices and far too slow for a network with a million. The listing still runs the brute force, but only as a check on the fast method: on the example graph, removing 0, 1, 5 or 6 leaves two components and removing any other vertex leaves one.
- Correct by definition, so it makes a good test oracle for the linear algorithm
- Removing a vertex also removes its edges; count components on what is left, not on the whole graph
Tarjan's Algorithm: Discovery Time and Low Value
- Visit u – disc[u] = low[u] = timer++.
- Back edge u – w (w visited, not the parent) – low[u] = min(low[u], disc[w]).
- Tree edge u → v – recurse, then low[u] = min(low[u], low[v]) and apply the tests below.
- Non-root rule – if u is not the root and low[v] ≥ disc[u], u is an articulation point.
- Bridge rule – if low[v] > disc[u], edge u – v is a bridge.
- Root rule – the root is an articulation point exactly when it has two or more DFS children.
Run one DFS. Give each vertex a discovery time disc[u], the order in which the DFS first reaches it. In an undirected DFS every non-tree edge is a back edge to an ancestor, since there are no cross edges. Tarjan's algorithm for articulation points adds a low value low[u], defined as the smallest disc reachable from u's subtree by following tree edges down and then at most one back edge up.
Low answers one question: can the subtree under v reach above its parent u without using the edge u – v? If it cannot, u (or the edge) is the only way in.
- ≥ for vertices, > for edges: a back edge landing exactly on u saves the edge but not the vertex
- The low rule is useless at the root: low[v] ≥ disc[root] = 0 always holds
- Skip only the tree edge to the parent; with parallel edges, skip it by edge id, not by vertex
Terms, operations, and practical uses
Core vocabulary
- Articulation pointCut vertex: removing it increases the number of components.
- BridgeCut edge: removing it increases the number of components.
- disc[u]When the DFS first reached u.
- low[u]Smallest disc reachable from u's subtree with at most one back edge.
- Back edgeA non-tree edge from a vertex to one of its DFS ancestors.
Rules
- Non-root cut vertexSome child v has low[v] ≥ disc[u].
- Root cut vertexAt least two DFS children.
- Bridgelow[v] > disc[u] for tree edge u – v.
- ComplexityO(V + E) time, O(V) space.
Related lessons
- Depth-First SearchDiscovery times and tree versus back edges.
- Strongly Connected ComponentsThe directed-graph counterpart, also built on low-link values.
- Cycle DetectionEdges on a cycle are exactly the edges that are not bridges.
- GraphsConnectivity and connected components.
Code in Python, C++ and Java
N = 8
EDGES = [(0, 1), (0, 4), (0, 5), (1, 2), (1, 3), (2, 3), (4, 5), (5, 6), (6, 7)]
def build(n, edges):
adj = [[] for _ in range(n)]
for u, v in edges:
adj[u].append(v)
adj[v].append(u)
for targets in adj:
targets.sort()
return adj
def cut_points_and_bridges(adj):
n = len(adj)
disc = [-1] * n
low = [0] * n
is_cut = [False] * n
bridges = []
timer = 0
def dfs(u, parent):
nonlocal timer
disc[u] = low[u] = timer
timer += 1
children = 0
for v in adj[u]:
if v == parent:
continue
if disc[v] != -1:
# Back edge: u can climb to an ancestor without its tree edge.
low[u] = min(low[u], disc[v])
continue
children += 1
dfs(v, u)
low[u] = min(low[u], low[v])
if parent != -1 and low[v] >= disc[u]:
is_cut[u] = True # v's subtree cannot get above u
if low[v] > disc[u]:
bridges.append((min(u, v), max(u, v))) # nor even back to u
if parent == -1 and children >= 2:
is_cut[u] = True # root: its subtrees meet only through it
for u in range(n):
if disc[u] == -1:
dfs(u, -1)
cuts = [u for u in range(n) if is_cut[u]]
return cuts, sorted(bridges), disc, low
def components(n, edges, gone_vertex=-1, gone_edge=None):
adj = [[] for _ in range(n)]
for u, v in edges:
if (u, v) != gone_edge and gone_vertex not in (u, v):
adj[u].append(v)
adj[v].append(u)
seen = [False] * n
count = 0
for s in range(n):
if s == gone_vertex or seen[s]:
continue
count += 1
seen[s] = True
todo = [s]
while todo:
u = todo.pop()
for v in adj[u]:
if not seen[v]:
seen[v] = True
todo.append(v)
return count
adj = build(N, EDGES)
cuts, bridges, disc, low = cut_points_and_bridges(adj)
print(f"Graph: {N} vertices, {len(EDGES)} edges")
print(" v disc low")
for v in range(N):
print(f"{v:>2} {disc[v]:>4} {low[v]:>3}")
print("Articulation points:", " ".join(str(v) for v in cuts))
print("Bridges:", " ".join(f"{u}-{v}" for u, v in bridges))
print()
base = components(N, EDGES)
print("Brute force, remove one vertex at a time:")
brute_cuts = []
for v in range(N):
c = components(N, EDGES, gone_vertex=v)
if c > base:
brute_cuts.append(v)
print(f" remove {v}: {c} component{'s' if c != 1 else ''}")
brute_bridges = [e for e in EDGES if components(N, EDGES, gone_edge=e) > base]
agree = brute_cuts == cuts and brute_bridges == bridges
print("Brute force agrees:", "yes" if agree else "no")#include <algorithm>
#include <cstdio>
#include <functional>
#include <string>
#include <utility>
#include <vector>
using Edge = std::pair<int, int>;
const int N = 8;
const std::vector<Edge> EDGES = {{0, 1}, {0, 4}, {0, 5}, {1, 2}, {1, 3},
{2, 3}, {4, 5}, {5, 6}, {6, 7}};
std::vector<std::vector<int>> build(int n, const std::vector<Edge>& edges) {
std::vector<std::vector<int>> adj(n);
for (auto [u, v] : edges) {
adj[u].push_back(v);
adj[v].push_back(u);
}
for (auto& targets : adj) std::sort(targets.begin(), targets.end());
return adj;
}
struct Result {
std::vector<int> cuts, disc, low;
std::vector<Edge> bridges;
};
Result cutPointsAndBridges(const std::vector<std::vector<int>>& adj) {
int n = adj.size(), timer = 0;
Result r;
r.disc.assign(n, -1);
r.low.assign(n, 0);
std::vector<bool> isCut(n, false);
std::function<void(int, int)> dfs = [&](int u, int parent) {
r.disc[u] = r.low[u] = timer++;
int children = 0;
for (int v : adj[u]) {
if (v == parent) continue;
if (r.disc[v] != -1) {
// Back edge: u can climb to an ancestor without its tree edge.
r.low[u] = std::min(r.low[u], r.disc[v]);
continue;
}
children++;
dfs(v, u);
r.low[u] = std::min(r.low[u], r.low[v]);
if (parent != -1 && r.low[v] >= r.disc[u]) isCut[u] = true; // v's subtree cannot get above u
if (r.low[v] > r.disc[u]) r.bridges.push_back({std::min(u, v), std::max(u, v)}); // nor back to u
}
if (parent == -1 && children >= 2) isCut[u] = true; // root: its subtrees meet only through it
};
for (int u = 0; u < n; u++)
if (r.disc[u] == -1) dfs(u, -1);
for (int u = 0; u < n; u++)
if (isCut[u]) r.cuts.push_back(u);
std::sort(r.bridges.begin(), r.bridges.end());
return r;
}
int components(int n, const std::vector<Edge>& edges, int goneVertex = -1, Edge goneEdge = {-1, -1}) {
std::vector<std::vector<int>> adj(n);
for (auto [u, v] : edges) {
if (Edge{u, v} == goneEdge || u == goneVertex || v == goneVertex) continue;
adj[u].push_back(v);
adj[v].push_back(u);
}
std::vector<bool> seen(n, false);
int count = 0;
for (int s = 0; s < n; s++) {
if (s == goneVertex || seen[s]) continue;
count++;
seen[s] = true;
std::vector<int> todo = {s};
while (!todo.empty()) {
int u = todo.back();
todo.pop_back();
for (int v : adj[u])
if (!seen[v]) {
seen[v] = true;
todo.push_back(v);
}
}
}
return count;
}
int main() {
auto adj = build(N, EDGES);
Result r = cutPointsAndBridges(adj);
std::printf("Graph: %d vertices, %d edges\n", N, (int)EDGES.size());
std::printf(" v disc low\n");
for (int v = 0; v < N; v++) std::printf("%2d %4d %3d\n", v, r.disc[v], r.low[v]);
std::string cuts, bridges;
for (int v : r.cuts) cuts += (cuts.empty() ? "" : " ") + std::to_string(v);
for (auto [u, v] : r.bridges)
bridges += (bridges.empty() ? "" : " ") + std::to_string(u) + "-" + std::to_string(v);
std::printf("Articulation points: %s\n", cuts.c_str());
std::printf("Bridges: %s\n", bridges.c_str());
std::printf("\n");
int base = components(N, EDGES);
std::printf("Brute force, remove one vertex at a time:\n");
std::vector<int> bruteCuts;
for (int v = 0; v < N; v++) {
int c = components(N, EDGES, v);
if (c > base) bruteCuts.push_back(v);
std::printf(" remove %d: %d component%s\n", v, c, c != 1 ? "s" : "");
}
std::vector<Edge> bruteBridges;
for (auto e : EDGES)
if (components(N, EDGES, -1, e) > base) bruteBridges.push_back(e);
bool agree = bruteCuts == r.cuts && bruteBridges == r.bridges;
std::printf("Brute force agrees: %s\n", agree ? "yes" : "no");
}import java.util.*;
public class Main {
static final int N = 8;
static final int[][] EDGES = {{0, 1}, {0, 4}, {0, 5}, {1, 2}, {1, 3}, {2, 3}, {4, 5}, {5, 6}, {6, 7}};
static List<List<Integer>> adj = new ArrayList<>();
static int[] disc = new int[N], low = new int[N];
static boolean[] isCut = new boolean[N];
static List<int[]> bridges = new ArrayList<>();
static int timer = 0;
static void dfs(int u, int parent) {
disc[u] = low[u] = timer++;
int children = 0;
for (int v : adj.get(u)) {
if (v == parent) continue;
if (disc[v] != -1) {
// Back edge: u can climb to an ancestor without its tree edge.
low[u] = Math.min(low[u], disc[v]);
continue;
}
children++;
dfs(v, u);
low[u] = Math.min(low[u], low[v]);
if (parent != -1 && low[v] >= disc[u]) isCut[u] = true; // v's subtree cannot get above u
if (low[v] > disc[u]) bridges.add(new int[] {Math.min(u, v), Math.max(u, v)}); // nor back to u
}
if (parent == -1 && children >= 2) isCut[u] = true; // root: its subtrees meet only through it
}
static int components(int goneVertex, int goneEdge) {
List<List<Integer>> g = new ArrayList<>();
for (int i = 0; i < N; i++) g.add(new ArrayList<>());
for (int i = 0; i < EDGES.length; i++) {
int u = EDGES[i][0], v = EDGES[i][1];
if (i == goneEdge || u == goneVertex || v == goneVertex) continue;
g.get(u).add(v);
g.get(v).add(u);
}
boolean[] seen = new boolean[N];
int count = 0;
for (int s = 0; s < N; s++) {
if (s == goneVertex || seen[s]) continue;
count++;
seen[s] = true;
Deque<Integer> todo = new ArrayDeque<>(List.of(s));
while (!todo.isEmpty()) {
int u = todo.pop();
for (int v : g.get(u))
if (!seen[v]) {
seen[v] = true;
todo.push(v);
}
}
}
return count;
}
public static void main(String[] args) {
for (int i = 0; i < N; i++) adj.add(new ArrayList<>());
for (int[] e : EDGES) {
adj.get(e[0]).add(e[1]);
adj.get(e[1]).add(e[0]);
}
for (List<Integer> targets : adj) Collections.sort(targets);
Arrays.fill(disc, -1);
for (int u = 0; u < N; u++)
if (disc[u] == -1) dfs(u, -1);
bridges.sort(Comparator.<int[]>comparingInt(e -> e[0]).thenComparingInt(e -> e[1]));
System.out.printf("Graph: %d vertices, %d edges%n", N, EDGES.length);
System.out.println(" v disc low");
for (int v = 0; v < N; v++) System.out.printf("%2d %4d %3d%n", v, disc[v], low[v]);
StringJoiner cuts = new StringJoiner(" "), br = new StringJoiner(" ");
List<Integer> cutList = new ArrayList<>();
for (int v = 0; v < N; v++)
if (isCut[v]) {
cuts.add(String.valueOf(v));
cutList.add(v);
}
for (int[] e : bridges) br.add(e[0] + "-" + e[1]);
System.out.println("Articulation points: " + cuts);
System.out.println("Bridges: " + br);
System.out.println();
int base = components(-1, -1);
System.out.println("Brute force, remove one vertex at a time:");
List<Integer> bruteCuts = new ArrayList<>();
for (int v = 0; v < N; v++) {
int c = components(v, -1);
if (c > base) bruteCuts.add(v);
System.out.printf(" remove %d: %d component%s%n", v, c, c != 1 ? "s" : "");
}
StringJoiner bruteBr = new StringJoiner(" ");
for (int i = 0; i < EDGES.length; i++)
if (components(-1, i) > base) bruteBr.add(EDGES[i][0] + "-" + EDGES[i][1]);
boolean agree = bruteCuts.equals(cutList) && bruteBr.toString().equals(br.toString());
System.out.println("Brute force agrees: " + (agree ? "yes" : "no"));
}
}Step through it
Running on 0–1, 0–4, 0–5, 1–2, 1–3, 2–3, 4–5, 5–6, 6–7, DFS from 0
Worked Example
The tracer runs the graph above. This smaller one tests the two rules the tracer does not stress: a root with one child, and a back edge that lands exactly on a vertex. The edges are 0–1, 1–2, 2–3, 3–1 and 2–4, and the DFS starts at 0.
The DFS walks 0 → 1 → 2 → 3, giving disc 0, 1, 2, 3. At 3, the edge to 1 is a back edge, so low[3] = 1. Back at 2, low[2] = 1. Then 2 → 4 gives disc 4, and 4 is a leaf with low[4] = 4.
Now the tests. At 2, child 4 has low 4 ≥ disc 2, so 2 is a cut vertex, and 4 > 2, so 2 – 4 is a bridge. Child 3 has low 1, which climbs above 2, so it does not help. At 1, child 2 has low 1 ≥ disc 1, so 1 is a cut vertex, but 1 > 1 fails, so 1 – 2 is not a bridge: the back edge 3 – 1 lands exactly on 1. At 0, child 1 has low 1 > 0, so 0 – 1 is a bridge. The root 0 has only one DFS child, so it is not a cut vertex, even though it is the end of a bridge.
- Cut vertices: 1 and 2. Bridges: 0 – 1 and 2 – 4
- 0 has degree 1: removing a leaf never disconnects what is left
- The back edge 3 – 1 is why ≥ and > differ: it saves the edge 1 – 2 but not the vertex 1
Running Time and Other Methods
Tarjan's method is a single DFS that does O(1) extra work per edge, so it runs in O(V + E) time on an adjacency list and O(V²) on an adjacency matrix. It stores disc, low and a flag per vertex: O(V) extra space, plus the recursion stack, which can be V deep on a path-shaped graph.
| Method | Finds | Time | Space |
|---|---|---|---|
| Brute force (remove vertex, recount) | cut vertices | O(V · (V + E)) | O(V) |
| Brute force (remove edge, recount) | bridges | O(E · (V + E)) | O(V) |
| Tarjan's DFS (disc, low) | both at once | O(V + E) | O(V) |
| Chain decomposition (Schmidt) | both | O(V + E) | O(V + E) |
- Linear time is optimal: every edge must be looked at
- Use an explicit stack instead of recursion for graphs with 10⁵+ vertices
- Run the DFS from every unvisited vertex to handle a disconnected graph
Where Cut Vertices and Bridges Matter
Both ideas measure network reliability: a cut vertex or bridge is a single point of failure. Finding them tells you where adding one redundant link or node would remove the weakness.
- Computer networks: routers and links whose failure splits the network
- Critical connections: the interview problem that asks for every bridge in a server network; bridges in a graph covers parallel edges and the bridge tree in depth
- Road and power grids: roads or lines with no alternative route
- Biconnected components: cut vertices are the joints between the blocks of the block-cut tree
- Bridge tree: delete every bridge, shrink each 2-edge-connected piece to a node, and the bridges join them into a tree
- Fix a bridge by adding any edge that closes a cycle through it
- Directed graphs use strongly connected components instead