Articulation Points — Why Parallel Cables Still Failed
Two cables, same landing station, total island blackout.
20+ years shipping performance-critical code where algorithms decide the bill. Notes here come from systems that actually shipped.
- ✓Deep production experience
- ✓Understanding of internals and trade-offs
- ✓Experience debugging complex systems
- Articulation point: vertex whose removal disconnects the graph. Bridge: edge whose removal disconnects the graph. Both are single points of failure in networks
- Tarjan's algorithm finds both in O(V+E) using discovery time (disc) and low-link value (low) per vertex
- low[u] = min(disc[u], disc[ancestor] reachable via back edge, low[child]): the earliest visited vertex reachable from subtree of u
- Bridge condition (u,v): low[v] > disc[u]. Subtree has no back edge to u or higher — edge is the only connection
- Production trap: Forgetting to handle root articulation point condition (root with ≥2 children) leads to missed articulation points
- Biggest mistake: Using low[v] >= disc[u] for all vertices, including root — correct condition is low[v] >= disc[u] for non-root, root with ≥2 children
Articulation points (also called cut vertices) are nodes in an undirected graph whose removal increases the number of connected components. In network terms, they're the single points of failure — if that router, switch, or link goes down, the network splits into disconnected islands.
The classic example is a parallel cable run between two buildings: even with redundant cables, if both cables pass through the same conduit or patch panel, that shared physical point is an articulation point. When it fails, all parallel paths fail simultaneously, because they share that single vulnerable node.
This is why redundant links alone don't guarantee fault tolerance — you must also eliminate articulation points from your topology.
Articulation points are discovered using a depth-first search (DFS) tree with two key metrics: discovery time (the order nodes are first visited) and low value (the earliest discovered node reachable via back edges from the subtree). A node is an articulation point if either (1) it's the DFS root with at least two child subtrees, or (2) it's not the root and has a child whose low value is >= the node's discovery time.
The low value essentially answers: "If I remove this node, can my descendants still reach my ancestors?" If not, this node is critical.
In practice, you'd use Tarjan's algorithm (O(V+E)) to find articulation points in real-world networks. Tools like NetworkX, igraph, and Boost Graph Library have built-in implementations. For production systems, you'd run this analysis on your network topology graph — generated from LLDP/CDP data or SDN controllers — to identify single points of failure before they cause outages.
The alternative is brute-force removal testing (remove each node, run BFS/DFS to check connectivity), which is O(V*(V+E)) and impractical for large networks. Don't use articulation points for directed graphs or edge failures — those require bridges (cut edges) or strongly connected components instead.
An articulation point is a vertex whose removal disconnects the graph — a single critical router whose failure splits the network. A bridge is an edge whose removal disconnects the graph — a single critical cable. Tarjan's algorithm finds all articulation points and bridges in one DFS pass using a clever 'low value' that tracks the furthest back each vertex can reach through its subtree.
| Chrome | Firefox | Safari | Edge |
|---|---|---|---|
| ✓ | ✓ | ✓ | ✓ |
In 2003, a single power line failure in Ohio cascaded into the largest blackout in North American history — 55 million people without power for up to two days. The power grid had articulation points: nodes whose failure disconnected major portions of the network. Finding and hardening these nodes is infrastructure reliability engineering.
Tarjan's bridge-finding algorithm (1972) finds all articulation points and bridges in a single O(V+E) DFS pass. It is one of the most elegant DFS applications: maintaining just two numbers per node (discovery time and low value), you can determine the entire structural vulnerability of a graph. Network engineers use this analysis to identify single points of failure. Social network researchers use it to find 'brokers' — people whose removal splits communities.
By the end you'll understand the difference between articulation points and bridges, how to compute low values during DFS, the two conditions that identify articulation points, and why the root vertex is a special case. You'll also be able to implement Tarjan's algorithm in code and explain its real-world applications in network reliability, social network analysis, and circuit design.
Why One Cable Failure Took Down the Whole Network
An articulation point (or cut vertex) is a node whose removal disconnects the graph into two or more components. Bridges are the edge analogue — removing a single edge that splits the graph. The core mechanic: if a vertex or edge lies on every path between any two nodes in separate parts of the graph, it's a single point of failure. In undirected graphs, articulation points are found via DFS with discovery times and low-link values, checking if a child's subtree has no back edge to an ancestor of the current node.
In practice, the algorithm runs in O(V+E) and identifies all cut vertices in one pass. The key property: a root node with two or more DFS-tree children is an articulation point; for non-root nodes, if low[child] >= disc[node], then node is an articulation point. Bridges follow a stricter condition: low[child] > disc[node]. These conditions directly expose which components are fragile — removing them fragments the graph into isolated clusters.
Use articulation points and bridges when designing fault-tolerant networks, analyzing social network resilience, or debugging why a parallel cable topology still failed. In distributed systems, they reveal exactly which routers or links, if lost, partition the cluster. Real-world example: a three-node cluster with two parallel cables between each pair still has a cut vertex — the central switch. Understanding this prevents expensive over-provisioning that misses the real single point of failure.
Discovery Time and Low Value
- disc[u]: The discovery time when vertex u is first visited in DFS
- low[u]: The minimum discovery time reachable from the subtree rooted at u (including back edges)
The low value is the key: it tells us if a subtree has a back edge to an ancestor. If it doesn't, the connection to that subtree is a bridge or articulation point.
from collections import defaultdict def find_articulation_and_bridges(graph: dict): visited = {} disc = {} low = {} parent = {} articulation = set() bridges = [] timer = [0] def dfs(u): visited[u] = True disc[u] = low[u] = timer[0] timer[0] += 1 children = 0 for v in graph[u]: if v not in visited: children += 1 parent[v] = u dfs(v) low[u] = min(low[u], low[v]) # Articulation point conditions: # 1. Root with ≥2 children if u not in parent and children > 1: articulation.add(u) # 2. Non-root: no back edge from subtree to ancestor if u in parent and low[v] >= disc[u]: articulation.add(u) # Bridge condition: low[v] > disc[u] if low[v] > disc[u]: bridges.append((u, v)) elif v != parent.get(u): # back edge low[u] = min(low[u], disc[v]) for node in graph: if node not in visited: dfs(node) return articulation, bridges graph = defaultdict(list) edges = [(1,2),(1,3),(2,3),(3,4),(4,5),(4,6),(5,6),(6,7)] for u,v in edges: graph[u].append(v) graph[v].append(u) ap, br = find_articulation_and_bridges(graph) print(f'Articulation points: {ap}') # {3, 4, 6} print(f'Bridges: {br}') # [(3,4),(6,7)]
C++ Implementation
The same Tarjan's algorithm is straightforward in C++ using arrays for disc, low, and adjacency list. Key differences from Python: explicit recursion limit is not an issue; use vector<vector<int>> for adjacency; pass timer by reference. The logic for articulation points and bridges remains identical.
Below is a complete C++ implementation that mimics the Python version above. It outputs articulation points and bridges for the same example graph.
#include <bits/stdc++.h> using namespace std; vector<int> disc, low; vector<bool> visited; set<int> articulation; vector<pair<int,int>> bridges; int timer = 0; void dfs(int u, int parent, vector<vector<int>>& adj) { visited[u] = true; disc[u] = low[u] = timer++; int children = 0; for (int v : adj[u]) { if (!visited[v]) { children++; dfs(v, u, adj); low[u] = min(low[u], low[v]); // articulation point conditions if (parent == -1 && children > 1) articulation.insert(u); if (parent != -1 && low[v] >= disc[u]) articulation.insert(u); // bridge condition if (low[v] > disc[u]) bridges.push_back({u, v}); } else if (v != parent) { low[u] = min(low[u], disc[v]); } } } int main() { vector<vector<int>> adj(8); // vertices 1..7 vector<pair<int,int>> edges = {{1,2},{1,3},{2,3},{3,4},{4,5},{4,6},{5,6},{6,7}}; for (auto [u,v] : edges) {\n adj[u].push_back(v);\n adj[v].push_back(u);\n } int n = 7; disc.assign(n+1, -1); low.assign(n+1, -1); visited.assign(n+1, false); for (int i=1; i<=n; i++) if (!visited[i]) dfs(i, -1, adj); cout << "Articulation points: "; for (int v : articulation) cout << v << " "; cout << endl; cout << "Bridges: "; for (auto [u,v] : bridges) cout << "(" << u << "," << v << ") "; cout << endl; return 0; }
parent == -1 root check. Prefer iterative DFS for large graphs.DFS Tree Visualization with Discovery Times and Low Values
Visualising the DFS tree helps internalise how discovery times and low values propagate. Consider the example graph from the code: vertices 1–7 with edges forming two biconnected components (1-2-3 cycle, 4-5-6 cycle, and a bridge (3,4) and leaf bridge (6,7)). The diagram below shows the DFS tree roots at vertex 1, with disc and low annotations.
Root (1) has children 2 and 3. Vertex 2 has low=1 via back edge (2-1). Vertex 3 has children 4. Vertex 4 has children 5 and 6. Vertex 6 has child 7. Back edges: (3,1) gives low[3]=1; (5,4) creates a cycle; (6,4) is another back edge.
- low[4] = 1 (reaches back to 3 via 5 and 6 subtree, but 3 reaches 1).
- low[5] = 2? Actually 5 can reach 4 which reaches back to 3.
- low[7] = 7 (no back edge).
- Bridge (3,4): low[4]=1, disc[3]=2? Wait disc[3]=2 (since disc[1]=0, disc[2]=1, disc[3]=2). low[4]=1? No, low[4] should be min of its descendants and back edges. Let's compute: disc[1]=0, disc[2]=1, disc[3]=2, disc[4]=3, disc[5]=4, disc[6]=5, disc[7]=6. low[7]=6, low[6]=min(disc[6]=5, low[7]=6, disc[4]=3 via back edge) -> low[6]=3. low[5]=min(disc[5]=4, low[6]=3) -> low[5]=3. low[4]=min(disc[4]=3, low[5]=3, low[6]=3, disc[3]=2 via back edge? (4,3) is parent edge? Actually parent of 4 is 3, so ignore. No other back edge from 4, so low[4]=3. low[3]=min(disc[3]=2, low[4]=3, disc[1]=0 via back edge (3,1)) -> low[3]=0. low[2]=min(disc[2]=1, disc[1]=0 via back edge (2,1)) -> low[2]=0. low[1]=disc[1]=0.
Then check bridge (3,4): low[4]=3, disc[3]=2, low[4] > disc[3] → true → bridge.
Understanding the Conditions
Bridge (u,v): Edge (u,v) is a bridge if low[v] > disc[u]. This means the subtree rooted at v has no back edge reaching u or any ancestor of u — the only connection is through edge (u,v).
Articulation point: 1. Root of DFS tree with ≥2 children: removing it disconnects children subtrees from each other. 2. Non-root u where low[v] ≥ disc[u] for some child v: the subtree rooted at v has no back edge to an ancestor of u — it can only reach above u through u itself.
- In a tree (no cycles), low[v] = disc[v] for all non-root vertices. There are no back edges, so you can't reach any ancestor.
- In a cycle, low values are all equal to the minimum disc of the cycle. Any vertex in a cycle can reach the 'top' of the cycle via back edges.
- A bridge exists when low[v] > disc[u] — v's subtree cannot reach u or higher. The edge (u,v) is the only connection.
- An articulation point exists when low[v] ≥ disc[u] for some child v — v's subtree cannot reach above u. Removing u disconnects that subtree from ancestors.
Applications
Network reliability: Articulation points = single points of failure in a network. Removing them disconnects the network — critical routers or hubs.
Social networks: Articulation points = brokers — people whose removal splits communities.
Biconnected components: Maximal subgraphs with no articulation points — 2-connected components with redundant paths between all vertex pairs.
Electronic circuits: Bridges = single connections whose failure breaks the circuit.
Advantages and Disadvantages
| Advantages | Disadvantages |
|---|---|
| O(V+E) time – single DFS pass, extremely efficient for static graphs | Requires recursion / explicit stack; deep recursion on large graphs may cause stack overflow in some languages |
| Discovers both articulation points and bridges simultaneously | Does not directly extend to directed graphs (need SCC algorithms) |
| Elegant and simple to implement correctly | Root condition oversight is a common source of bugs |
| Works on any undirected graph, including disconnected graphs | Parallel edges require special handling (count edges) |
| Low memory overhead – only two arrays per vertex | Weakly suitable for dynamic graphs (edge insertions/deletions require full recomputation) |
Scalability note: For graphs with millions of vertices, use iterative DFS in C++ or Java. The algorithm's linear time makes it practical for real-world network topologies (≈100k nodes) even in Python with recursion limit increased.
Biconnected Components Extraction
After finding articulation points, we can extract biconnected components (also called 2-connected components) — maximal subgraphs without articulation points. This is useful for understanding redundancy at a finer granularity than articulation points alone.
Algorithm: Maintain a stack of edges during DFS. When we encounter a back edge or tree edge, push it onto the stack. When an articulation point is detected (low[v] >= disc[u] or root with children>1), pop edges from the stack until we pop (u,v). All popped edges form one biconnected component.
Below is Python code that extracts biconnected components alongside articulation points and bridges. The example graph yields three components: {edges: (1,2),(1,3),(2,3)}, {(3,4)}, {(4,5),(4,6),(5,6),(6,7)}? Actually (6,7) is a bridge, so it is its own component? Let's see: Bridges are themselves biconnected components (a single edge is a biconnected component of size 1 edge). Our algorithm will correctly split at articulation points.
from collections import defaultdict def biconnected_components(graph): visited = {} disc = {} low = {} parent = {} articulation = set() bridges = [] bcc = [] # list of list of edges stack = [] timer = [0] def dfs(u): visited[u] = True disc[u] = low[u] = timer[0] timer[0] += 1 children = 0 for v in graph[u]: if not visited.get(v): parent[v] = u children += 1 stack.append((u,v)) # push tree edge dfs(v) low[u] = min(low[u], low[v]) # articulation point check if (u not in parent and children > 1) or (u in parent and low[v] >= disc[u]): articulation.add(u) # pop component comp = [] while stack and stack[-1] != (u,v): comp.append(stack.pop()) comp.append(stack.pop()) # pop (u,v) bcc.append(comp) if low[v] > disc[u]: bridges.append((u,v)) elif v != parent.get(u) and disc[v] < disc[u]: # back edge (only to ancestor) low[u] = min(low[u], disc[v]) stack.append((u,v)) # push back edge for node in graph: if not visited.get(node): dfs(node) # remaining edges form a component if stack: bcc.append(list(stack)) stack.clear() return articulation, bridges, bcc graph = defaultdict(list) edges = [(1,2),(1,3),(2,3),(3,4),(4,5),(4,6),(5,6),(6,7)] for u,v in edges: graph[u].append(v) graph[v].append(u) ap, br, bcc = biconnected_components(graph) print('Articulation points:', ap) # {3, 4, 6} print('Bridges:', br) # [(3,4), (6,7)] print('Biconnected components:') for i, comp in enumerate(bcc, 1): print(f' BCC {i}: {comp}')
Practice Problems
Sharpen your Tarjan’s algorithm skills with these curated problems. They cover articulation points, bridges, biconnected components, and variations.
Online Bridge Finding for Dynamic Graphs
Tarjan’s algorithm works on static graphs. In real networks, edges are added and removed continuously (e.g., fiber cuts, new links, traffic rerouting). Maintaining bridges and articulation points online — with updates in polylogarithmic time — is an advanced topic.
The state-of-the-art algorithm is the Holm–de Lichtenberg–Thorup (HLT) algorithm (2001), which maintains bridges under edge insertions and deletions in O(log^2 n) amortised time per update. It uses a link-cut tree and Euler tour trees to dynamically manage connectivity.
A simpler approach for practical use: re-run Tarjan’s algorithm after a batch of updates. If the graph is moderate (<100k edges) and updates are infrequent (every few minutes), full recomputation is acceptable. For high-frequency updates (millions of edges per second), incremental algorithms become necessary.
Reference: Holm, J., de Lichtenberg, K., Thorup, M. (2001). Poly-logarithmic deterministic fully-dynamic algorithms for connectivity, minimum spanning tree, 2-edge-connectivity, and biconnectivity. Journal of the ACM, 48(4), 723–760.
Production applications: - ISP backbone monitoring: detect new bridges (potential single points of failure) as links are added/removed. - Cloud network orchestration: ensure that after scaling up/down, no new articulation points emerge. - Social network evolution: track how community brokers change over time.
Find Bridges Using Tarjan’s Algorithm
The naive approach — remove every edge, run DFS, check connectivity — runs in O(E*(V+E)). That’s fine for coding interviews. It’s trash for production graphs with thousands of nodes.
Tarjan’s algorithm cuts that to O(V+E) by doing a single DFS pass. The key insight: during DFS, track two numbers for each node — disc (when you first visited it) and low (the smallest disc reachable via back edges from its subtree). If an edge (u→v) has low[v] > disc[u], there’s no alternative path from v back to u or any ancestor. That edge is a bridge.
Translation: if removing that edge isolates v from u’s side of the graph, you found a vulnerability. This is exactly what root cause analysis looks like after a network partition. One DFS pass, one stack, no second guess.
// io.thecodeforge — dsa tutorial void findBridges(List<Integer>[] graph) { int n = graph.length; boolean[] visited = new boolean[n]; int[] disc = new int[n]; int[] low = new int[n]; int[] time = new int[1]; // mutable clock for (int i = 0; i < n; i++) { if (!visited[i]) { dfs(i, -1, graph, visited, disc, low, time); } } } void dfs(int u, int parent, List<Integer>[] graph, boolean[] visited, int[] disc, int[] low, int[] time) { visited[u] = true; disc[u] = low[u] = ++time[0]; for (int v : graph[u]) { if (!visited[v]) { dfs(v, u, graph, visited, disc, low, time); low[u] = Math.min(low[u], low[v]); if (low[v] > disc[u]) { System.out.println("Bridge: " + u + " - " + v); } } else if (v != parent) { low[u] = Math.min(low[u], disc[v]); // back edge } } }
Biconnected Components: Why You Care
A biconnected component (BCC) is a maximal subgraph where removing any single node leaves the rest connected. Think of it as a network’s structural cell — if every component is biconnected, one router crash won’t partition your data center.
Key properties: each edge belongs to exactly one BCC. A node can belong to multiple BCCs — those nodes are articulation points. For example, in a graph connecting two data centers through a single shared switch, that switch is the articulation point bridging two BCCs.
BCCs aren’t academic. They drive redundancy planning, circuit design, and fault-tolerant routing. When you can say “this graph has 3 BCCs, so we need 3 independent power feeds,” you’re speaking infrastructure language.
// io.thecodeforge — dsa tutorial void findBCC(List<Integer>[] graph) { int n = graph.length; boolean[] visited = new boolean[n]; int[] disc = new int[n]; int[] low = new int[n]; int[] time = new int[1]; Stack<int[]> edgeStack = new Stack<>(); for (int i = 0; i < n; i++) { if (!visited[i]) { dfsBCC(i, -1, graph, visited, disc, low, time, edgeStack); } // Pop remaining edges if graph had multiple components while (!edgeStack.isEmpty()) { printComponent(edgeStack); } } } void dfsBCC(int u, int parent, List<Integer>[] graph, boolean[] visited, int[] disc, int[] low, int[] time, Stack<int[]> edgeStack) { visited[u] = true; disc[u] = low[u] = ++time[0]; int children = 0; for (int v : graph[u]) { if (!visited[v]) { edgeStack.push(new int[]{u, v}); dfsBCC(v, u, graph, visited, disc, low, time, edgeStack); low[u] = Math.min(low[u], low[v]); if (low[v] >= disc[u]) { printComponent(edgeStack); // pop until (u,v) } children++; } else if (v != parent && disc[v] < disc[u]) { edgeStack.push(new int[]{u, v}); low[u] = Math.min(low[u], disc[v]); } } }
Visualizing Low Values in a DFS Tree
To understand articulation points and bridges, you must grasp 'low values' as the core heuristic. In a DFS tree, each node has a discovery time (tin) and a low value (low). The low value of a node is the smallest discovery time reachable from that node via tree edges and at most one back edge. Visualizing this on a graph: start DFS from node 0, assign tin=0, then traverse to node 1 (tin=1), node 2 (tin=2). If node 2 has a back edge to node 0 (tin=0), its low becomes min(low[2], tin[0]) = 0. This propagates upward: node 1 updates its low to 0 as well. The key insight: a node's low value tells you how 'connected' its subtree is to ancestors. For bridges, an edge (u,v) is a bridge if low[v] > tin[u] — meaning v's subtree cannot reach u or any ancestor without that edge. For articulation points (non-root), u is an articulation point if low[v] >= tin[u], meaning v's subtree is cut off from u's ancestors if u is removed. The root is articulation if it has at least two children. Visualization: draw a tree with tin/low pairs next to each node; arrows show back edges lifting low values. This low-value logic is the soul of Tarjan's algorithm.
// io.thecodeforge — dsa tutorial void dfs(int u, int p, int[][] adj, int[] tin, int[] low, int[] timer) { tin[u] = low[u] = ++timer[0]; for (int v : adj[u]) { if (v == p) continue; if (tin[v] != 0) { low[u] = Math.min(low[u], tin[v]); } else { dfs(v, u, adj, tin, low, timer); low[u] = Math.min(low[u], low[v]); // Bridge? if (low[v] > tin[u]) -> edge u-v is bridge } } }
Edge Cases: Disconnected Graphs and Multiple Edges
When implementing articulation point or bridge finding, standard Tarjan’s algorithm assumes a connected, simple graph. Real graphs may be disconnected or have multiple edges (parallel edges). For disconnected graphs, run DFS from every unvisited node; each connected component yields its own DFS forest. Articulation points are computed per component. Missing this leads to missing cut vertices in separate components. For multiple edges (same pair of nodes connected by more than one edge), a bridge condition weakens: an edge is not a bridge if there is another direct edge between the same nodes. In DFS, handle by counting edge occurrences. A simple way: use adjacency list with edge ids, and skip only the direct reverse edge (not all edges to parent). Alternatively, store edge count per pair; if count > 1, no edge between them is a bridge. Also consider self-loops: a self-loop can never be a bridge or articulation point (it doesn't affect connectivity). Another edge case: root articulation — the root is an articulation point only if it has at least two children in the DFS tree. This is often forgotten when the root is a leaf in the original graph. Finally, update low values correctly for back edges: use tin[v], not low[v], because low[v] may include information from other back edges that could cause incorrect propagation. These subtle errors cause production outages in network reliability tools.
// io.thecodeforge — dsa tutorial void findBridges(int n, List<Integer>[] adj, boolean[] visited) { int[] tin = new int[n], low = new int[n]; int[] timer = {0}; for (int i = 0; i < n; i++) { if (!visited[i]) { dfs(i, -1, adj, visited, tin, low, timer); } } }
The Undersea Cable Cut That Isolated an Island
- Parallel edges are not vertex redundancy. Two cables between the same pair of nodes still fail together if either endpoint fails.
- Articulation points are single points of failure at the vertex level. Bridges are single points of failure at the edge level.
- Tarjan's algorithm should be part of network design review. Find articulation points before building, not after.
- Edge redundancy (multiple cables) protects against cable cuts, not vertex failure (landing station fire). For true redundancy, need vertex-disjoint paths.
python -c "import networkx as nx; G = nx.Graph(edges); print(list(nx.articulation_points(G)))" using NetworkXgrep -n 'low\[.*\] >= disc' implementation.pyecho 'Remove vertex L and see if island reaches mainland'networkx: nx.node_connectivity(G) gives vertex connectivitypython -c "print('Tree?', nx.is_tree(G))"printf 'Leaf count: %d\n', sum(1 for v in G if len(G[v]) == 1)ulimit -s 65536; python -c "import sys; sys.setrecursionlimit(2000000)"pip install memory-profiler; mprof run python tarjan.pypython -c "from collections import Counter; edge_counts = Counter(G.edges()); bridges = [e for e in bridges if edge_counts[e] == 1]"printf 'Number of parallel edges: %d\n', sum(1 for e, count in edge_counts.items() if count > 1)| Concept | Definition | Condition (Tarjan's) | Removal Impact | Redundancy Level | Example |
|---|---|---|---|---|---|
| Articulation Point | Vertex whose removal increases number of connected components | Root: children > 1; Non-root: low[v] >= disc[u] for some child v | Splits graph into multiple components | Vertex-level single point of failure | Router whose removal disconnects network |
| Bridge | Edge whose removal increases number of connected components | low[v] > disc[u] for edge (u,v) with u parent of v | Splits graph into multiple components | Edge-level single point of failure | Cable whose cut isolates a region |
| Biconnected Component | Maximal set of edges where any two edges lie on a common simple cycle | Computed from articulation points — split at articulation points | Articulation points separate components | 2-vertex-connected within component | Ring topology where any two points have two disjoint paths |
| 2-Edge-Connected Component | Maximal set of vertices where any two vertices have two edge-disjoint paths | Computed from bridges — split at bridges | Bridges separate components | 2-edge-connected within component | Graph with parallel edges (no bridges) |
| File | Command / Code | Purpose |
|---|---|---|
| io | from collections import defaultdict | Discovery Time and Low Value |
| io | using namespace std; | C++ Implementation |
| io | from collections import defaultdict | Biconnected Components Extraction |
| BridgeFinderTarjan.java | void findBridges(List<Integer>[] graph) { | Find Bridges Using Tarjan’s Algorithm |
| BiconnectedComponents.java | void findBCC(List<Integer>[] graph) { | Biconnected Components |
| LowValuesVisualization.java | void dfs(int u, int p, int[][] adj, int[] tin, int[] low, int[] timer) { | Visualizing Low Values in a DFS Tree |
| DisconnectedGraphHandling.java | void findBridges(int n, List<Integer>[] adj, boolean[] visited) { | Edge Cases |
Key takeaways
Common mistakes to avoid
5 patternsUsing low[v] >= disc[u] for root vertices
Updating low[u] with disc[v] for back edge but using disc[u] itself in conditions
Considering parallel edges (multiple edges between same vertices) in bridge detection
Not handling disconnected graphs
Using recursion for large graphs causing RecursionError
sys.setrecursionlimit(10**6). Or implement iterative DFS with explicit stack to avoid recursion entirely for graphs > 1M vertices.LeetCode-style practice: solve it right here
Write your solution, run it against real tests, and submit against hidden ones. Python or JavaScript, in your browser, no account.
Substation Single Points of Failure
Hard✓ SolvedA regional power grid connects substations with transmission lines. Engineers suspect some substations are single points of failure: if one goes offline, part of the grid becomes unreachable from the rest. They need a list of those critical substations, sorted, to prioritize reinforcement.
You are given n substations numbered 0 to n-1 and an undirected list of edges, where each edge [a, b] is a transmission line between substations a and b. Return, sorted ascending, the list of articulation points: vertices whose removal (along with all incident lines) increases the number of connected components of the graph. If there are none, return an empty list. The graph may be disconnected and may contain multiple parallel edges between the same pair.
Run a DFS tracking disc (visit order) and low (earliest reachable discovery time). A vertex u is an articulation point if some child subtree cannot reach u or above.
For a non-root u, the condition is low[v] >= disc[u] for some child v. For the root, that condition is wrong — instead check whether the root has at least 2 DFS children.
Parallel edges matter: skipping only the single parent edge (not all edges to the parent) keeps a back edge alive, so a doubled cable correctly prevents a false articulation point.
Tarjan's DFS assigns each vertex a discovery time and a low-link value (the earliest discovery time reachable from its subtree via back edges). For a non-root vertex u, if a child v has low[v] >= disc[u], removing u disconnects that subtree, so u is an articulation point. The root is special: it is an articulation point only if it has two or more DFS children. Skipping only the single parent edge (rather than all edges to the parent) correctly handles parallel edges, since a second cable to the parent acts as a back edge.
Time O(V + E) · Space O(V + E)
Interview Questions on This Topic
What is the difference between an articulation point and a bridge in a graph?
How does the low value in Tarjan's algorithm help identify bridges?
Why are root vertices in the DFS tree treated specially for articulation points?
Give a real-world application where finding articulation points is critical.
Frequently Asked Questions
No — if edge (u,v) is part of a cycle, there is an alternative path from u to v (the rest of the cycle). Removing the edge doesn't disconnect the graph. Bridges are always edges NOT part of any cycle.
An articulation point is a vertex (node) whose removal increases the number of connected components. A bridge is an edge whose removal does the same. All bridges are edges between articulation points (or articulation point and leaf). Not all articulation points are incident to bridges; they can be part of cycles where removing the vertex still creates disconnection.
For a bridge, we need that the subtree of v has absolutely no connection to u or any ancestor. If it had a back edge to u exactly (low[v] == disc[u]), that back edge provides an alternative path from v's subtree to u, so (u,v) isn't a bridge. For articulation point, if subtree of v has a back edge to u (low[v] == disc[u]), removing u still disconnects v's subtree from ancestors above u? Actually, if there's a back edge from v's subtree to u, the subtree can still reach u, but if u is removed, that back edge is useless because u is gone. The subtree can't reach ancestors above u because the back edge only reaches u itself. So low[v] == disc[u] still makes u an articulation point — the subtree cannot bypass u to higher ancestors. That's why bridge condition uses >, articulation point uses ≥.
20+ years shipping performance-critical code where algorithms decide the bill. Notes here come from systems that actually shipped.
That's Graphs. Mark it forged?
8 min read · try the examples if you haven't