Skip to lesson

Bridges and articulation points

Tarjan's linear DFS identifies critical bridges and cut vertices representing single points of failure in an undirected network.

Single points of failure: bridges and articulation points

In an undirected network, a bridge is an edge whose removal increases the number of connected components. An articulation point, or cut vertex, is a node whose removal disconnects the graph. These structural bottlenecks represent single points of failure in physical and digital networks.

Brute force testing removes each edge or vertex individually and runs BFS to check connectivity. This brute force trial requires O(E * (V + E)) time for bridges and O(V * (V + E)) for cut vertices. In large server networks with thousands of connections, this quadratic cost is far too slow.

Bridge edge between components

Step 1 of 3

111bridgeABCD
tinA
1
lowA
1
Triangle A-B-C connected to node D via edge C-D. DFS starts at A with tin[A] = 1.

Tarjan's algorithm discovers all bridges and articulation points in a single linear pass. It traverses the graph using depth-first search in O(V + E) time. By tracking discovery times and back edges, it evaluates vulnerability during the traversal.

Discovery times and low-link rules

Tarjan's algorithm assigns every visited vertex an incrementing discovery timestamp tin[u]. The low-link value low[u] records the lowest tin reachable from u via its subtree and at most one back edge.

When exploring neighbour v from u, skip the immediate parent edge that led to u.

Example 1 · Brute force: remove each edge and re-run a search, O(E * (V + E))

Main.javaJava
import java.util.*;
public class Main {    static void dfs(int u, List<List<Integer>> adj, boolean[] seen) {        seen[u] = true;        for (int v : adj.get(u)) {            if (!seen[v]) dfs(v, adj, seen);        }    }
    public static void main(String[] args) {        int n = 4;        int[][] edges = {{0, 1}, {1, 2}, {2, 0}, {1, 3}};        List<String> bridges = new ArrayList<>();
        for (int skip = 0; skip < edges.length; skip++) {            List<List<Integer>> adj = new ArrayList<>();            for (int i = 0; i < n; i++) adj.add(new ArrayList<>());            for (int i = 0; i < edges.length; i++) {                if (i == skip) continue;                      // pretend this edge is cut                adj.get(edges[i][0]).add(edges[i][1]);                adj.get(edges[i][1]).add(edges[i][0]);            }            boolean[] seen = new boolean[n];            dfs(0, adj, seen);            for (boolean s : seen) {                if (!s) {                                     // someone became unreachable                    bridges.add("[" + edges[skip][0] + ", " + edges[skip][1] + "]");                    break;                }            }        }        System.out.println("Critical connections: " + bridges);    }}
Output
Critical connections: [[1, 3]]

What this code does

  • Each edge is removed in turn and one DFS checks whether every vertex is still reachable.
  • That is E searches of O(V + E) each, which is too slow for a network with thousands of links.
  • Tarjan's algorithm finds all bridges in one DFS by comparing discovery times.

Example 2 · Optimal: Tarjan low-link DFS, O(V + E) time

CriticalConnectionsDemo.javaJava
import java.util.ArrayList;import java.util.Arrays;import java.util.List;
public class CriticalConnectionsDemo {    private static int timer;
    public static List<List<Integer>> findBridges(int n, List<List<Integer>> connections) {        List<List<Integer>> adj = new ArrayList<>();        for (int i = 0; i < n; i++) adj.add(new ArrayList<>());        for (List<Integer> edge : connections) {            adj.get(edge.get(0)).add(edge.get(1));            adj.get(edge.get(1)).add(edge.get(0));        }
        int[] tin = new int[n];        int[] low = new int[n];        List<List<Integer>> bridges = new ArrayList<>();        timer = 0;
        for (int i = 0; i < n; i++) {            if (tin[i] == 0) dfs(i, -1, adj, tin, low, bridges);        }        return bridges;    }
    private static void dfs(int u, int parent, List<List<Integer>> adj, int[] tin, int[] low, List<List<Integer>> bridges) {        tin[u] = low[u] = ++timer;        for (int v : adj.get(u)) {            if (v == parent) continue; // Skip immediate parent edge            if (tin[v] > 0) {                // Back edge                low[u] = Math.min(low[u], tin[v]);            } else {                // Forward tree edge                dfs(v, u, adj, tin, low, bridges);                low[u] = Math.min(low[u], low[v]);                if (low[v] > tin[u]) {                    bridges.add(Arrays.asList(u, v));                }            }        }    }
    public static void main(String[] args) {        int n = 4;        List<List<Integer>> connections = Arrays.asList(            Arrays.asList(0, 1),            Arrays.asList(1, 2),            Arrays.asList(2, 0),            Arrays.asList(1, 3)        );        List<List<Integer>> bridges = findBridges(n, connections);        System.out.println("Critical connections: " + bridges);    }}
Output
Critical connections: [[1, 3]]

What this code does

  • Tracks discovery times tin and lowest reachable times low during depth-first search.
  • Identifies that low[3] (4) > tin[1] (2), proving edge [1, 3] is the sole critical connection.
  • Edges (0, 1), (1, 2), and (2, 0) form a cycle and therefore cannot be bridges.
  • One DFS answers every edge at once using tin and low, instead of one new search per removed edge.

Example 3 · Finding Articulation Points (Cut Vertices)

ArticulationPointsDemo.javaJava
import java.util.ArrayList;import java.util.List;
public class ArticulationPointsDemo {    private static int timer;
    public static List<Integer> findCutVertices(int n, int[][] edges) {        List<List<Integer>> adj = new ArrayList<>();        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]);        }
        int[] tin = new int[n];        int[] low = new int[n];        boolean[] isCut = new boolean[n];        timer = 0;
        for (int i = 0; i < n; i++) {            if (tin[i] == 0) dfs(i, -1, adj, tin, low, isCut);        }
        List<Integer> result = new ArrayList<>();        for (int i = 0; i < n; i++) if (isCut[i]) result.add(i);        return result;    }
    private static void dfs(int u, int parent, List<List<Integer>> adj, int[] tin, int[] low, boolean[] isCut) {        tin[u] = low[u] = ++timer;        int children = 0;
        for (int v : adj.get(u)) {            if (v == parent) continue;            if (tin[v] > 0) {                low[u] = Math.min(low[u], tin[v]);            } else {                children++;                dfs(v, u, adj, tin, low, isCut);                low[u] = Math.min(low[u], low[v]);                if (parent != -1 && low[v] >= tin[u]) {                    isCut[u] = true;                }            }        }        if (parent == -1 && children > 1) {            isCut[u] = true; // Root special case        }    }
    public static void main(String[] args) {        int n = 4;        int[][] edges = {{0, 1}, {1, 2}, {2, 0}, {1, 3}};        List<Integer> cuts = findCutVertices(n, edges);        System.out.println("Articulation points: " + cuts);    }}
Output
Articulation points: [1]

What this code does

  • Applies low[v] >= tin[u] for non-root nodes and children > 1 for the DFS tree root.
  • Identifies vertex 1 as the only articulation point separating triangle {0, 1, 2} from leaf 3.
  • Runs in optimal linear O(V + E) time.

For any tree edge (u, v), if low[v] > tin[u], then edge (u, v) is a bridge. This condition proves that v and its subtree have zero back edges reaching u or above. Cutting edge (u, v) permanently traps v and its entire subtree with no way back.

For articulation points, non-root vertex u is a cut vertex if low[v] >= tin[u] for any child v. This means child v cannot reach any strict ancestor of u without passing through u. For the DFS root, it is an articulation point if and only if it has more than one child in the DFS tree.

Find the bug

Spot the low-link bug

Select the line that is wrong.

Edge (u, v) is a bridge when v and its subtree cannot reach u or above.

Round 1 of 3

Critical connections in computer networks

Telecommunications and datacenter clusters rely on high availability architectures. If a single fiber optic cable or server router fails, traffic must reroute automatically. Bridges represent single points of failure where a single cable cut partitions the network.

Example 4 · Network Resiliency Analysis

NetworkResiliencyDemo.javaJava
import java.util.ArrayList;import java.util.List;
public class NetworkResiliencyDemo {    public static boolean isBiconnected(int n, int[][] edges) {        if (n <= 2) return false;        List<List<Integer>> adj = new ArrayList<>();        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]);        }
        int[] tin = new int[n];        int[] low = new int[n];        boolean[] isCut = new boolean[n];        int[] timer = {0};
        dfs(0, -1, adj, tin, low, isCut, timer);
        for (int i = 0; i < n; i++) {            if (tin[i] == 0 || isCut[i]) return false;        }        return true;    }
    private static void dfs(int u, int p, List<List<Integer>> adj, int[] tin, int[] low, boolean[] isCut, int[] timer) {        tin[u] = low[u] = ++timer[0];        int children = 0;        for (int v : adj.get(u)) {            if (v == p) continue;            if (tin[v] > 0) {                low[u] = Math.min(low[u], tin[v]);            } else {                children++;                dfs(v, u, adj, tin, low, isCut, timer);                low[u] = Math.min(low[u], low[v]);                if (p != -1 && low[v] >= tin[u]) isCut[u] = true;            }        }        if (p == -1 && children > 1) isCut[u] = true;    }
    public static void main(String[] args) {        int n = 4;        // Ring network: 0-1, 1-2, 2-3, 3-0        int[][] ring = {{0, 1}, {1, 2}, {2, 3}, {3, 0}};        System.out.println("Ring is biconnected: " + isBiconnected(n, ring));    }}
Output
Ring is biconnected: true

What this code does

  • Evaluates whether a 4-node ring network contains any cut vertices.
  • Confirms that removing any single vertex leaves the remaining 3 vertices fully connected.
  • Verifies network resilience against single node failures.

In network design, algorithms flag critical connections so backup lines can be provisioned. A network with zero bridges is 2-edge-connected, meaning at least two edges must fail to disconnect it. Similarly, a biconnected component contains no articulation points. When implementing bridge finding, beware of parallel edges between the same vertex pair. Treat multiple edges between u and v as distinct connections rather than false parent edges. Passing edge indices rather than vertex IDs handles multi-graphs cleanly.

Next step

Check your understanding

10 quick questions