 # Computing all s-t bridges and articulation points simplified

Given a directed graph G and a pair of nodes s and t, an s-t bridge of G is an edge whose removal breaks all s-t paths of G. Similarly, an s-t articulation point of G is a node whose removal breaks all s-t paths of G. Computing the sequence of all s-t bridges of G (as well as the s-t articulation points) is a basic graph problem, solvable in linear time using the classical min-cut algorithm. When dealing with cuts of unit size (s-t bridges) this algorithm can be simplified to a single graph traversal from s to t avoiding an arbitrary s-t path, which is interrupted at the s-t bridges. Further, the corresponding proof is also simplified making it independent of the theory of network flows.

## Authors

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1 Introduction

Connectivity and reachability are fundamental graph-theoretical problems studied extensively in the literature [5, 8, 4, 10]. A key notion underlying such algorithms is that of edges (or nodes) critical for connectivity or reachability. The most basic variant of these are bridges (or articulation points), which are defined as follows. A bridge of an undirected graph, also referred as cut edge, is an edge whose removal increases the number of connected components. Similarly, a strong bridge in a (directed) graph is an edge whose removal increases the number of strongly connected components of the graph. (Strong) articulation points are defined in an analogous manner by replacing edge with node.

Special applications consider the notion of bridges to be parameterised by the nodes that become disconnected upon its removal [9, 12]. Given a node , we say that an edge is an  bridge (also referred as edge dominators from source  ) if there exists a node that is no longer reachable from when the edge is removed. Moreover, given both nodes and , an - bridge (or - articulation point) is an edge (or node) whose removal makes no longer reachable from .

### Related work.

For undirected graphs, the classical algorithm by Tarjan  computes all bridges and articulation points in linear time. However, for directed graphs only recently Italiano et al.  presented an algorithm to compute all strong bridges and strong articulation points in linear time. They also showed that classical algorithms [12, 7] compute bridges in linear time. The articulation points (or dominators) are extensively studied resulting in several linear-time algorithms [1, 3, 2].

The - bridges were essentially studied as minimum - cuts in network flow graphs, where an - bridge is a cut of unit size. The classical Ford Fulkerson algorithm  can be used to identify the first - bridge in the residual graph after pushing unit flow in the network. Moreover, contracting the entire cut to , one can continue finding the next - bridge and so on. Since - bridges limit the maximum flow to one, the algorithm completes in linear time.

## 2 Preliminaries

Let be a fixed directed graph, where is a set of nodes and a set of edges, with two given nodes . Let and denote the result of removing all edges from , and all nodes from together with their incident edges, respectively. Given an edge , denotes its head and denotes its tail.

Let be the set of - bridges of . By definition, for all there exists no path from to in (see Figure 1), and all - bridges in appear on every - path in . Further, the - bridges in are visited in the same order by every - path in .

###### Lemma 1.

The - bridges in are visited in the same order by every - path in .

###### Proof.

It is sufficient to prove that for any , all (where ), can be categorised into those which are always visited before and those that are always visited after irrespective of the - path chosen in . Consider the graph , observe that every such is either reachable from , or can reach . It cannot fall in both categories as it would result in an - path in , which violates being an - bridge. Further, it has to be in at least one category by considering any - path of , where appears either between and or between and . Hence, those reachable from in are always visited before , and those able to reach in are always visited after , irrespective of the - path chosen in . ∎

Thus, abusing the notation we define to be a sequence of - bridges ordered by their visit time on any - path. Also, such a bridge sequence implies an increasing part of the graph being reachable from in , as increases. We thus divide the graph reachable from into bridge components , where (for ) denotes the part of graph that is reachable from in but was not reachable in (if any). Additionally, for notational convenience we assume to be the part of the graph reachable from in , but not in (see Figure 1). Since bridge components are separated by - bridges, every - path enters at a unique vertex ( or for ) referred as its entry. Similarly, it leaves at a unique vertex ( or for ) referred as its exit.

Similarly, the - articulation points are defined as the set of nodes , such that removal of any - articulation point in disconnects all - paths in . Thus, is a set of nodes such that there exist no path from to in . The - articulation points in also follow a fixed order in every - path (like - bridges), so can be treated as a sequence and it defines the corresponding components  (see Figure 2). Note that the entry and exit of an articulation component are the preceding and succeeding - articulation points (if any), else and respectively.

## 3 Algorithm

The algorithm can essentially be described as a forward search from to avoiding an arbitrary - path, which is interrupted at the - bridges (or - articulation points). It discovers the bridge sequence (or articulation sequence ) in order as the search proceeds. We first present a linear-time algorithm for - bridges, and then extend it to - articulation points.

The algorithm first chooses an arbitrary - path in . Then it performs a forward search from to reach by avoiding the edges of . This search is interrupted by the - bridges, since all the - bridges lie on (by definition). If the forward search stops before reaching , it necessarily requires to traverse an edge in (i.e. the first - bridge) to reach . So we continue to forward search from until we stop again to find the next - bridge, and so on until we reach . When the search is interrupted for the time, we look at the last node on , that was visited by the search. The - bridge is then identified as the outgoing edge of on . Figure 3: Transformation of the graph along s-t path for computing s-t bridges.

However, notice that once such a node is traversed, all the edges on preceding it are clearly not - bridges. Further, the paths starting from these edges may also allow the forward search to proceed further on beyond . Hence these edges need to be traversed by the forward search before identifying an - bridge. This extra procedure can be embedded in the original forward interrupted search of the graph by performing a simple transformation of the graph. Essentially, instead of removing the path from the graph, we merely reverse it (see Figure 3). Thus, traversing a node on makes its preceding edges reachable from , ensuring that the traversal is interrupted only on the - bridges.

We now formally describe the algorithm (refer to the pseudocode in Algorithm 1). After choosing an arbitrary - path , it transforms the graph as described above, by reversing the path . Along with computing the bridge sequence and bridge components , we also ensure access to the component of a node . This is stored in which is initialised to , also serving as an indicator that is not visited. Thereafter, it initiates the search with a queue containing , the entrance of . The forward search continues removing and visiting nodes in , and adding their unvisited out-neighbours back to , until becomes empty and the search stops. Every node visited during this search is assigned to and has . If is not visited yet, the last node in that was visited by the search is identified (i.e. the exit of ). The - bridge is identified to be the outgoing edge of in (say , see Figure 1), and added to . The forward search is then continued from (i.e. the entrance of ) by adding it to , and so on. Otherwise, if was already visited when the search stopped, we terminate the algorithm with bridge sequence and the bridge components and node associations in and respectively.

## 4 Analysis and Correctness

The algorithm essentially performs five steps which need to be analysed. Firstly, computing an - path which requires time, by using standard search procedures like DFS or BFS traversal. Secondly, transforming the graph which essentially adds and removes edges each, requiring time. Thirdly, performing the interrupted forward search which only visits the previously unvisited nodes. Hence it requires total time like a simple BFS traversal using the Queue and the inner loop. Fourthly, identifying the last visited node on which traverses only once in the whole algorithm, requiring total time. Finally, updating , and requires to visit the outer loop for each - bridge, requiring total time as the number of - bridges and nodes are . Thus, the algorithm requires overall time to compute all the - bridges and the associated components.

The correctness of the algorithm can be proven by maintaining the following invariant.

Invariant In the transformed graph, the forward search started from the entrance of

1. visits exactly the nodes in , and

2. stops along the path exactly on the exit of .

###### Proof.

The graph transformation only affects the paths passing through the edges of , as the remaining edges are unaffected. Hence, to prove it is sufficient to prove that the nodes on within , say (entrance)(exit), are reachable from the entrance . We prove it by induction over the nodes , where the base case () is trivially true. Figure 4: Reachability of vj from v1 (entrance) in the transformed graph. The path P′ (blue) is the alternate s-t path avoiding ej, which leaves P before ej for the last time at u, then joins P again after ej at v. The subpath of P′ from u to v followed by reverse path of P to vj (green), reaches vj from u and hence v1.

For any (see Figure 4), assuming nodes up to are reachable from the entrance, we consider the edge . Since is not an - bridge, there exists a path from to (and hence from entrance to exit ) without using in the original graph. Let and respectively be the nodes at which leaves for the last time before , and the node at which joins again after . The nodes and necessarily exist as the path passes through and . Note that the subpath of from to does not pass through any edge in by definition. Now, () is reachable from in the transformed graph by induction hypothesis, and there is a path from to in the reverse path of . Thus, is reachable from (and hence ) through in the transformed graph.

Using induction, we have every and hence the entire is reachable from , proving . Further, since is an - bridge which is reversed and hence removed in the transformed graph, the forward search cannot reach . This is because there is no other edge from to including the reversed edges of . Hence, the forward search stops exactly at the exit along proving . Now, by induction assuming is computed correctly, all would also be computed correctly proving for all . ∎

## 5 Extension for s-t articulation points. Figure 5: Transformation of the graph along s-t path for computing s-t articulation points.

In order to compute them efficiently, we can use the same algorithm with a different graph transformation. Each node on is split into two nodes and , having all incoming edges now incoming to and all outgoing edges now outgoing from . Further, we have an edge from to , which is the internal edge of the node . This transformation maintains the path where each node is split into two by an internal edge. Thus, in the new graph the internal edges of the - articulation points also act as - bridges. Now, when the previous transformation is applied, it reverses the - path thereby reversing the internal edges as well. Further, to prevent the search to interrupt at the original - bridges, the non-internal edges of are added back to (see Figure 5).

On executing the same algorithm on the new graph, it reports all the - bridges of the modified graph, i.e., the internal edges of the - articulation points. Also, the components reported are the corresponding components of . The new transformation adds nodes and edges to the graph, and the correctness and analysis follow the same arguments. Thus, we have the following theorem.

###### Theorem 2.

Given a graph with nodes, edges and , there exists an algorithm to compute all - bridges (or articulation points) along with their component associations, in time.

## 6 Conclusions

We have presented a simple algorithm for computing - bridges (or articulation points) along with their component associations. Further, it has a simpler proof and is easier to use in practice compared to .

## References

•  S. Alstrup, D. Harel, P. W. Lauridsen, and M. Thorup (1999) Dominators in linear time. SIAM J. Comput. 28 (6), pp. 2117–2132. Cited by: §1.
•  A. L. Buchsbaum, L. Georgiadis, H. Kaplan, A. Rogers, R. E. Tarjan, and J. R. Westbrook (2008) Linear-time algorithms for dominators and other path-evaluation problems. SIAM J. Comput. 38 (4), pp. 1533–1573. Cited by: §1.
•  A. L. Buchsbaum, H. Kaplan, A. Rogers, and J. R. Westbrook (2005) Corrigendum: a new, simpler linear-time dominators algorithm. ACM Trans. Program. Lang. Syst. 27 (3), pp. 383–387. Cited by: §1.
•  T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein (2009) Introduction to algorithms, 3rd edition. MIT Press. Cited by: §1.
•  R. Diestel (2010) Graph theory. Fourth edition, Graduate Texts in Mathematics, Vol. 173, Springer. External Links: ISBN 9783642142789 3642142788 9783642142796 3642142796 Cited by: §1.
•  L. R. Ford and D. R. Fulkerson (1956) Maximal flow through a network. Canadian Journal of Mathematics 8, pp. 399–404. External Links: Document Cited by: Computing all - bridges and articulation points simplified, §1, §6.
•  H. N. Gabow and R. E. Tarjan (1985) A linear-time algorithm for a special case of disjoint set union. J. Comput. Syst. Sci. 30 (2), pp. 209–221. Cited by: §1.
•  J. L. Gross, J. Yellen, and P. Zhang (2013) Handbook of graph theory, second edition. 2nd edition, Chapman & Hall/CRC. External Links: ISBN 1439880182 Cited by: §1.
•  G. F. Italiano, L. Laura, and F. Santaroni (2012) Finding strong bridges and strong articulation points in linear time. Theor. Comput. Sci. 447, pp. 74–84. Cited by: §1, §1.
•  S. S. Skiena (2008) The algorithm design manual. 2nd edition, Springer Publishing Company, Incorporated. External Links: ISBN 1848000693 Cited by: §1.
•  R. E. Tarjan (1974) A note on finding the bridges of a graph. Inf. Process. Lett. 2 (6), pp. 160–161. Cited by: §1.
•  R. E. Tarjan (1976) Edge-disjoint spanning trees and depth-first search. Acta Inf. 6, pp. 171–185. Cited by: §1, §1.