Guest User
Using app without sign in

Practice book
Graph Theory Through Problems300 Exercises with Hints, Worked Algorithms and Complete Solutions
By Mohammed Islam Hadjoudj
Learn graph theory by solving problems: 300 exercises, from routine checks to challenging proofs, each with a complete solution.
Also by the authorGraph Algorithms for Coding Interviews100 solved interview problems with visual explanations and Python solutions.View on AmazonSelect an algorithm and generate steps to begin visualization
The pieces that survive losing any one vertex
Splits an undirected graph into blocks that survive losing any one vertex, and finds the cut vertices
Select an algorithm and generate steps to begin visualization
A biconnected component, or block, of an undirected graph is a maximal subgraph that stays connected after deleting any single vertex. Every edge belongs to exactly one block, two blocks share at most one vertex, and the shared vertices are exactly the cut vertices (articulation points). A bridge is a block with a single edge. Hopcroft and Tarjan gave the linear-time algorithm in 1973.
A depth-first search numbers the vertices in the order it reaches them, disc(v), and computes low(v): the smallest disc that v's part of the DFS tree can reach with one back edge. Every edge the search uses, tree edge or back edge, is pushed on a stack. When the search returns from a child v to its parent u and low(v) ≥ disc(u), nothing below v reaches above u, so u separates that part from the rest: the edges on the stack down to u - v are popped as one block. The vertex u is then a cut vertex, unless it is the DFS root with a single child. One DFS does everything in O(V + E) time.
Blocks and cut vertices measure how fault-tolerant a network is: a cut vertex is a single point of failure in communication, power and transport networks. The block-cut tree built from them is used in planarity testing, in algorithms for 2-SAT and Hamiltonicity, and in network design that adds the fewest links to remove every single point of failure. Biconnectivity is a standard topic after articulation points and bridges in graph theory courses.
The Hopcroft-Tarjan algorithm finds the biconnected components, or blocks, in one depth-first search. It keeps the edges on a stack and pops off a whole block whenever a vertex turns out to separate its subtree from the rest.
Biconnected(graph):
time = 0, edgeStack = []
for each vertex u not yet visited: visit(u, none)
visit(u, parent):
disc[u] = low[u] = ++time
for each neighbor v of u:
if v not visited: // tree edge
push (u, v) on edgeStack
visit(v, u)
low[u] = min(low[u], low[v])
if low[v] >= disc[u]: // u separates v
pop edges down to (u, v): one block
else if v != parent and disc[v] < disc[u]: // back edge
push (u, v) on edgeStack
low[u] = min(low[u], disc[v])low[v] is the smallest discovery time reachable from the subtree of v using tree edges down and at most one back edge up. When low[v] >= disc[u], nothing below v can climb above u, so the edges pushed since (u, v) form a block that meets the rest of the graph only at u. A vertex that closes such a block is a cut vertex, except that the DFS root is one only if it has two or more tree children.
Find the blocks of the example this page loads, which is the same graph as the articulation points and bridges pages: two triangles joined through a path, plus a pendant vertex.
Example graph: Undirected edges A-B, A-C, B-C (first triangle), C-D (a link), D-E, D-F, E-F (second triangle) and F-G (a pendant edge).
There are four blocks, {F, G}, {D, E, F}, {C, D} and {A, B, C}, and three cut vertices, C, D and F, each belonging to two blocks. The two blocks with a single edge, C-D and F-G, are exactly the bridges of the graph. Joining each block to its cut vertices gives the block-cut tree, here a simple path: {A, B, C}, C, {C, D}, D, {D, E, F}, F, {F, G}.
Time: O(V + E) · Space: O(V + E)
The DFS visits each vertex once and examines each edge once from each endpoint. Every edge is pushed onto the edge stack exactly once, as a tree edge or as a back edge, and popped exactly once, so the stack operations add O(E) in total. The arrays disc and low take O(V) and the edge stack up to O(E). The whole decomposition therefore costs the same as a single DFS, which is what made the 1973 Hopcroft-Tarjan paper a landmark.
Biconnected components refine several simpler connectivity questions. Choose the one that matches what may fail in your network.
| Alternative | Prefer it when | Cost |
|---|---|---|
| Articulation points | You only need the vertices whose removal disconnects the graph, not the pieces between them. | O(V + E) |
| Bridges | Links fail rather than nodes, so you want the single edges whose removal disconnects the graph. | O(V + E) |
| 2-edge-connected components | You want the pieces that survive the loss of any one edge. They are what remains after deleting all bridges. | O(V + E) |
| SPQR trees | You need the next level, triconnected components, for example in graph drawing or planarity testing. | O(V + E) |
Related algorithms: Articulation Points, Bridge Finding, Connected Components, Tarjan's SCC Algorithm