22-2 Articulation points, bridges, and biconnected components

Let G=(V,E)G = (V, E) be a connected, undirected graph. An articulation point of GG is a vertex whose removal disconnects GG. A bridge of GG is an edge whose removal disconnects GG. A biconnected component of GG is a maximal set of edges such that any two edges in the set lie on a common simple cycle. Figure 22.10 illustrates these definitions. We can determine articulation points, bridges, and biconnected components using depth-first search. Let Gπ=(V,Eπ)G_\pi = (V, E_\pi) be a depth-first tree of GG.

a. Prove that the root of GπG_\pi is an articulation point of GG if and only if it has at least two children in GπG_\pi.

b. Let vv be a nonroot vertex of GπG_\pi. Prove that vv is an articulation point of GG if and only if vv has a child ss such that there is no back edge from ss or any descendant of ss to a proper ancestor of vv.

c. Let

v.low=min{v.d,w.d:(u,w) is a back edge for some descendant u of v. v.low = \min \begin{cases} v.d, \\ w.d:(u,w) \text{ is a back edge for some descendant } u \text{ of } v. \end{cases}

Show how to computer v.lowv.low for all vertices vVv \in V in O(E)O(E) time.

d. Show how to compute all articulation points in O(E)O(E) time.

e. Prove that an edge of GG is a bridge if and only if it does not lie on any simple cycle of GG.

f. Show how to compute all the bridges of GG in O(E)O(E) time.

g. Prove that the biconnected components of GG partition the nonbridge edges of GG.

h. Give an O(E)O(E)-time algorithm to label each edge ee of GG with a positive integer e.bcce.bcc such that e.bcc=e.bcce.bcc = e'.bcc if and only if ee and ee' are in the same biconnected component.

a. First suppose the root rr of GπG_\pi is an articulation point. Then the removal of rr from GG would cause the graph to disconnect, so rr has at least 22 children in GG. If rr has only one child vv in GπG_\pi then it must be the case that there is a path from vv to each of rr's other children. Since removing rr disconnects the graph, there must exist vertices uu and ww such that the only paths from uu to ww contain rr.

To reach rr from uu, the path must first reach one of rr's children. This child is connect to vv via a path which doesn't contain rr.

To reach ww, the path must also leave rr through one of its children, which is also reachable by vv. This implies that there is a path from uu to ww which doesn't contain rr, a contradiction.

Now suppose rr has at least two children uu and vv in GπG_\pi. Then there is no path from uu to vv in GG which doesn't go through rr, since otherwise uu would be an ancestor of vv. Thus, removing rr disconnects the component containing uu and the component containing vv, so rr is an articulation point.

b. Suppose that vv is a nonroot vertex of GπG_\pi and that vv has a child ss such that neither ss nor any of ss's descendants have back edges to a proper ancestor of vv. Let rr be an ancestor of vv, and remove vv from GG. Since we are in the undirected case, the only edges in the graph are tree edges or back edges, which means that every edge incident with ss takes us to a descendant of ss, and no descendants have back edges, so at no point can we move up the tree by taking edges. Therefore rr is unreachable from ss, so the graph is disconnected and vv is an articulation point.

Now suppose that for every child of vv there exists a descendant of that child which has a back edge to a proper ancestor of vv. Remove vv from GG. Every subtree of vv is a connected component. Within a given subtree, find the vertex which has a back edge to a proper ancestor of vv. Since the set TT of vertices which aren't descendants of vv form a connected component, we have that every subtree of vv is connected to TT. Thus, the graph remains connected after the deletion of vv so vv is not an articulation point.

c. Since vv is discovered before all of its descendants, the only back edges which could affect v.lowv.low are ones which go from a descendant of vv to a proper ancestor of vv. If we know u.lowu.low for every child uu of vv, then we can compute v.lowv.low easily since all the information is coded in its descendants.

Thus, we can write the algorithm recursively: If vv is a leaf in GπG_\pi then v.lowv.low is the minimum of v.dv.d and w.dw.d where (v,w)(v, w) is a back edge. If vv is not a leaf, vv is the minimum of v.dv.d, w.dw.d where (v,w)(v, w) is a back edge, and u.lowu.low, where uu is a child of vv. Computing v.lowv.low for a vertex is linear in its degree. The sum of the vertices' degrees gives twice the number of edges, so the total runtime is O(E)O(E).

d. First apply the algorithm of part (c) in O(E)O(E) to compute v.lowv.low for all vVv \in V. If v.lowv.low = v.dv.d if and only if no descendant of vv has a back edge to a proper ancestor of vv, if and only if vv is not an articulation point.

Thus, we need only check v.lowv.low versus v.dv.d to decide in constant time whether or not vv is an articulation point, so the runtime is O(E)O(E).

e. An edge (u,v)(u, v) lies on a simple cycle if and only if there exists at least one path from uu to vv which doesn't contain the edge (u,v)(u, v), if and only if removing (u,v)(u, v) doesn't disconnect the graph, if and only if (u,v)(u, v) is not a bridge.

f. A edge (u,v)(u, v) lies on a simple cycle in an undirected graph if and only if either both of its endpoints are articulation points, or one of its endpoints is an articulation point and the other is a vertex of degree 11. There's also a special case where there's only one edge whose incident vertices are both degree 11. We can check this case in constant time. Since we can compute all articulation points in O(E)O(E) and we can decide whether or not a vertex has degree 11 in constant time, we can run the algorithm in part (d) and then decide whether each edge is a bridge in constant time, so we can find all bridges in O(E)O(E) time.

g. It is clear that every nonbridge edge is in some biconnected component, so we need to show that if C1C_1 and C2C_2 are distinct biconnected components, then they contain no common edges. Suppose to the contrary that (u,v)(u, v) is in both C1C_1 and C2C_2.

Let (a,b)(a, b) be any edge in C1C_1 and (c,d)(c, d) be any edge in C2C_2.

Then (a,b)(a, b) lies on a simple cycle with (u,v)(u, v), consisting of the path

a,b,p1,,pk,u,v,pk+1,,pn,a.a, b, p_1, \ldots, p_k, u, v, p_{k + 1}, \ldots, p_n, a.

Similarly, (c,d)(c, d) lies on a simple cycle with (u,v)(u, v) consisting of the path

c,d,q1,,qm,u,v,qm+1,,ql,c.c, d, q_1, \ldots, q_m, u, v, q_{m + 1}, \ldots, q_l, c.

This means

a,b,p1,,pk,u,qm,,q1,d,c,ql,,qm+1,v,pk+1,,pn,a, b, p_1, \ldots, p_k, u, q_m, \ldots, q_1, d, c, q_l , \ldots, q_{m + 1}, v, p_{k + 1}, \ldots, p_n,

is a simple cycle containing (a,b)(a, b) and (c,d)(c, d), a contradiction. Thus, the biconnected components form a partition.

h. Locate all bridge edges in O(E)O(E) time using the algorithm described in part (f). Remove each bridge from EE. The biconnected components are now simply the edges in the connected components. Assuming this has been done, run the following algorithm, which clearly runs in O(E)O(|E|) where E|E| is the number of edges originally in GG.

VISIT-BCC(G, u, k)
    u.color = GRAY
    for each v ∈ G.Adj[u]
        (u, v).bcc = k
        if v.color == WHITE
            VISIT-BCC(G, v, k)