Linear-Time Algorithms for Computing Twinless Strong Articulation Points and Related Problems

07/08/2020 ∙ by Loukas Georgiadis, et al. ∙ Fedora Summer University 0

A directed graph G=(V,E) is twinless strongly connected if it contains a strongly connected subgraph without any pair of antiparallel (or twin) edges. The twinless strongly connected components (TSCCs) of a directed graph G are its maximal twinless strongly connected subgraphs. These concepts have several diverse applications, such as the design of telecommunication networks and the structural stability of buildings. A vertex v ∈ V is a twinless strong articulation point of G, if the deletion of v increases the number of TSCCs of G. Here, we present the first linear-time algorithm that finds all the twinless strong articulation points of a directed graph. We show that the computation of twinless strong articulation points reduces to the following problem in undirected graphs, which may be of independent interest: Given a 2-vertex-connected (biconnected) undirected graph H, find all vertices v that belong to a vertex-edge cut pair, i.e., for which there exists an edge e such that H ∖{v,e} is not connected. We develop a linear-time algorithm that not only finds all such vertices v, but also computes the number of edges e such that H ∖{v,e} is not connected. This also implies that for each twinless strong articulation point v, that is not a strong articulation point in a strongly connected digraph G, we can compute the number of TSCCs in G ∖ v. We note that the problem of computing all vertices that belong to a vertex-edge cut pair can be solved in linear-time by exploiting the structure of 3-vertex connected (triconnected) components of H, represented by an SPQR tree of H. Our approach, however, is conceptually simple and thus likely to be more amenable to practical implementations.

READ FULL TEXT VIEW PDF
POST COMMENT

Comments

There are no comments yet.

Authors

page 1

page 2

page 3

page 4

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

Let be a directed graph (digraph), with edges and vertices. Digraph is strongly connected if there is a directed path from each vertex to every other vertex. The strongly connected components (SCCs) of are its maximal strongly connected subgraphs. Two vertices are strongly connected if they belong to the same strongly connected component of . We refer to a pair of antiparallel edges, and , of as twin edges. A digraph is twinless strongly connected if it contains a strongly connected subgraph without any pair of twin edges. The twinless strongly connected components (TSCCs) of are its maximal twinless strongly connected subgraphs. Two vertices are twinless strongly connected if they belong to the same twinless strongly connected component of . Twinless strong connectivity is motivated by several diverse applications, such as the design of telecommunication networks and the structural stability of buildings [17]. Raghavan [17] provided a characterization of twinless strongly connected digraphs, and, based on this characterization, provided a linear-time algorithm for computing the TSCCs of a digraph.

In this paper, we further explore the notion of twinless strong connectivity, with respect to -connectivity in digraphs. An edge (resp., a vertex) of a digraph is a strong bridge (resp., a strong articulation point) if its removal increases the number of strongly connected components. Thus, strong bridges (resp., strong articulation points) are -edge (resp., -vertex) cuts for digraphs. A strongly connected digraph is -edge-connected if it has no strong bridges, and it is -vertex-connected if it has at least three vertices and no strong articulation points. Let . The induced subgraph of , denoted by , is the subgraph of with vertex set and edge set . If is -edge-connected (resp., -vertex-connected), and there is no set of vertices with such that is also -edge-connected (resp., -vertex-connected), then is a maximal -edge-connected (resp., -vertex-connected) subgraph of . Two vertices are said to be -edge-connected (resp., -vertex-connected) if there are two edge-disjoint (resp., two internally vertex-disjoint) directed paths from to and two edge-disjoint (resp., two internally vertex-disjoint) directed paths from to (note that a path from to and a path from to need not be edge- or vertex-disjoint). A -edge-connected component (resp., -vertex-connected component) of a digraph is defined as a maximal subset such that every two vertices are -edge-connected (resp., -vertex-connected). We note that connectivity-related problems for digraphs are known to be much more difficult than for undirected graphs, and indeed many notions for undirected connectivity do not translate to the directed case. See, e.g., [3, 9, 11]. Indeed, it has only recently been shown that all strong bridges and strong articulation points of a digraph can be computed in linear time [13]. Additionally, it was shown very recently how to compute the -edge- and -vertex-connected components of digraphs in linear time [7, 8], while the best current bound for computing the maximal -edge- and the -vertex-connected subgraphs in digraphs is not even linear, but it is  [3, 11].

[trim=0 0 0 12.5cm, clip=true, width=]TwinlessSAP-example.pdf

Figure 1: A -vertex-connected digraph that is not twinless -vertex-connected. Vertices , , and are twinless strong articulation points but not strong articulation points; for instance, is strongly connected but not twinless strongly connected.

The above notions extend naturally to the case of twinless strong connectivity. An edge is a twinless strong bridge of if the deletion of increases the number of TSCCs of . Similarly, a vertex is a twinless strong articulation point of , if the deletion of increases the number of TSCCs of . A linear-time algorithm for detecting all twinless strong bridges can be derived by combining the linear-time algorithm of Italiano et al. [13] for computing all the strong bridges of a digraph and the linear-time algorithm of Tsin [20] for computing the -edge-connected components of a graph. Previously, Jaberi [16] studied the properties of twinless strong articulation points and some related concepts, and presented an -time algorithm for their computation, where is the number of strong articulation points of . Hence, this bound is in the worst case. Here, we present a linear-time algorithm that identifies all the twinless strong articulation points. Specifically, we show that the computation of twinless strong articulation points reduces to the following problem in undirected graphs, which may be of independent interest: Given a -vertex-connected (biconnected) undirected graph , find all vertices that belong to a vertex-edge cut pair, i.e., for which there exists an edge such that is not connected. We develop a linear-time algorithm that not only finds all such vertices , but also computes the number of vertex-edge cut pairs of (i.e., the number of edges such that is not connected). This implies that, for each twinless strong articulation point , that is not a strong articulation point in a digraph , we can also compute the number of twinless strongly connected components of .

Our algorithm exploits properties of depth-first search (DFS), and concepts that are defined on the structure given by the DFS, which are reminiscent of the seminal -vertex connected (triconnected) components algorithm of Hopcroft and Tarjan [12]. Indeed, we can compute the vertices that form a vertex-edge cut pair by exploiting the structure of the triconnected components of , represented by an SPQR tree [1, 2] of . (See Appendix A for details.) In order to construct an SPQR tree, however, we need to know the triconnected components of the graph [10], and efficient algorithms that compute triconnected components are considered conceptually complicated (see, e.g., [5, 10, 12]). Our approach, on the other hand, is conceptually simple and thus likely to be more amenable to practical implementations. Also, we believe that our results and techniques will be useful for the design of faster algorithms for related connectivity problems, such as computing twinless -connected components [14, 15].

2 Preliminaries

Let be a (directed or undirected) graph. We denote by and , respectively, the vertex set and edge set of . For a set of edges (resp., vertices) , we let denote the graph that results from after deleting the edges in (resp., the vertices in and their adjacent edges). We extend this notation for mixed sets , that may contain both vertices and edges of , in the obvious way. Also, if has only one element , then we abbreviate by . Let . The induced subgraph of , denoted by , is the subgraph of with vertex set and edge set .

For any digraph , the associated undirected graph is a graph with vertices and edges . Let be an undirected graph. An edge is a bridge if its removal increases the number of connected components of . A connected graph is -edge-connected if it contains no bridges. Raghavan [17] proved the following characterization of twinless strongly connected digraphs.

Theorem 2.1.

([17]) Let be a strongly connected digraph. Then is twinless strongly connected if and only if its underlying undirected graph is -edge-connected.

Theorem 2.1 implies a linear-time algorithm to compute the twinless strongly connected components (TSCCs) of a digraph . It suffices to compute the strongly connected components, , of and compute the -edge-connected components of each underlying undirected graph , . All these computations take linear time [18].

3 Computing twinless strong bridges

Another immediate consequence of Theorem 2.1 is that a twinless strong bridge in a twinless strongly connected graph is either a strong bridge or an edge whose removal destroys the -edge connectivity in the underlying graph. All strong bridges can be found in linear time [13]. To compute the edges of type , we only have to find all the edges of the underlying graph whose removal destroys the -edge connectivity.

Lemma 3.1.

An edge in a twinless strongly connected graph is a twinless strong bridge but not a strong bridge if and only if its twin is not an edge of , and is not -edge-connected.

Proof.

Let be an edge in a twinless strongly connected graph which is a twinless strong bridge but not a strong bridge. Theorem 2.1 implies, that the removal of this edge leaves us with a graph whose underlying undirected graph is not -edge-connected. Now, since the initial graph is twinless strongly connected, its underlying undirected graph is -edge-connected, therefore the twin of is not an edge of (otherwise, the removal of would leave the underlying graph unchanged). The converse is an immediate consequence of Theorem 2.1. ∎

This suggests the following algorithm for the computation of all twinless strong bridges. First, we mark all edges that are strong bridges. Then we find all edges in the underlying graph which belong to a cut-pair, and mark those that correspond to an edge in the initial graph whose twin is missing from it. An algorithm which computes, in linear time, all the edges which belong to a cut-pair in a -edge-connected undirected graph is given by Tsin [20].

In Appendix B we apply the framework that we develop in Section 4.1, in order to provide an alternative linear-time algorithm for computing all the edges that belong to a cut-pair in a -edge-connected undirected graph. Our algorithm also counts, for every edge , all edges such that is a cut-pair. This is useful for counting the TSCCs after the removal of a twinless strong bridge that is not a strong bridge, in a twinless strongly connected digraph (see Lemma B.1). Furthermore, we describe how a minor extension of our algorithm can efficiently answer queries of the form “report all edges that form a cut-pair with ”.

4 Computing twinless strong articulation points

It is an immediate consequence of Theorem 2.1 that a twinless strong articulation point in a twinless strongly connected digraph is either a strong articulation point or a vertex whose removal destroys the -edge connectivity in the underlying undirected graph . Since all strong articulation points can be computed in linear time [13], it remains to find all vertices of type . Note that such a vertex either entirely destroys the connectivity of the underlying graph with its removal, or , upon removal, it leaves us with a graph that is connected but not -edge-connected. Clearly, the set of vertices with property are a subset of the set of strong articulation points. Therefore, it suffices to find all vertices with property . To that end, we process each -vertex-connected component of separately, as the next lemma suggests.

Lemma 4.1.

Let be a -edge-connected undirected graph. Let be a vertex that is not an articulation point, and let be its -vertex-connected component (2VCC). For any edge , is not connected if and only if belongs to and is not connected.

Proof.

() Since is -edge-connected, it contains no bridges. Therefore, every 2VCC of contains at least three vertices, and thus it is a -vertex-connected subgraph of . Now, let be an edge such that the graph is not connected, and let be the 2VCC of that contains . Suppose, for contradiction, that . Since is -vertex-connected, is must also be -edge-connected, so is not a bridge in . Moreover, is not an articulation point, so it is contained in only one 2VCC of . Hence, . This means that is not a bridge in , and therefore it is not a bridge in .
() Recall the block graph representation of  [4]: Let be the graph whose vertices are the 2VCCs and the articulation points of , and which contains an edge if and only if connects a 2VCC with an articulation point ; then is a tree. Now, suppose that there exists an edge in such that is not connected, but is connected. This means that there exists a simple path in connecting and . Since and are not connected in , must contain vertices from . So let be the first vertex in such that but its successor in is not (such a vertex exists, since ). Since is in and has a neighbor that belongs to a different 2VCC, it is an articulation point. Now let be the first vertex after in such that (such a vertex exists, since ). Due to the tree structure of the 2VCCs of , we conclude that . (In other words, when a path leaves a 2VCC through an articulation point, in order to return to this 2VCC it must pass again through the same articulation point.) But this contradicts the simplicity of . ∎

So, in order to find all twinless strong articulation points, it is sufficient to solve the following problem: Given a -vertex-connected undirected graph , find all vertices for which there exists an edge such that is not connected. Next, we describe a linear-time algorithm for this problem. Our algorithm utilizes properties of depth-first search (DFS), which are reminiscent of the seminal algorithm of Hopcroft and Tarjan for computing the triconnected components of a graph [12].

Formally, our main technical contribution is summarized in the following theorem:

Theorem 4.2.

Let be an undirected graph. There is a linear time algorithm that computes, for all vertices that are not articulation points of , the number of edges such that is not connected.

Then, Theorem 4.2 implies the following results:

Corollary 4.3.

Let be a twinless strongly connected digraph. There is a linear time algorithm that finds all the twinless strong articulation points of . Moreover, for all twinless strong articulation points that are not strong articulation points of , the algorithm computes (in linear time) the number of TSCCs in .

Corollary 4.4.

Let be a connected undirected graph. After linear-time preprocessing, we can answer queries of the form: Given a vertex that is not an articulation point of , report all the edges in the set , in time.

4.1 Depth-first search, low and high points

Let be a -vertex-connected graph. We consider a DFS traversal of , starting from an arbitrarily selected vertex , and let be the resulting DFS tree [18]. A vertex is an ancestor of a vertex ( is a descendant of ) if the tree path from to contains . Thus, we consider a vertex to be an ancestor (and, consequently, a descendant) of itself. We let denote the parent of a vertex in . If is a descendant of in , we denote the set of vertices of the simple tree path from to as . The expressions and have the obvious meaning (i.e., the vertex on the side of the parenthesis is excluded from the tree path). Furthermore, we let denote the subtree of rooted at vertex . We identify vertices in by their DFS number, i.e., the order in which they were discovered by the search. Hence, means that vertex was discovered before . The edges in are called tree-edges; the edges in are called back-edges, as their endpoints have ancestor-descendant relation in . When we write to denote a back-edge, we always mean that , i.e., is an descendant of in .

[trim=0 0 0 4.5cm, clip=true, width=]DFS.pdf

Figure 2: Concepts defined on the structure of the DFS tree that are essential to our algorithm. Dashed lines correspond to DFS tree paths. Back-edges are shown directed from descendant to ancestor.

Now we describe some concepts that are defined on the structure given by the DFS and are essential to our algorithm. For an illustration, see Figure 2. Let us note beforehand, that all these concepts are well-defined, for is -vertex-connected. Define the “low point”, , of a vertex , as the minimum vertex (w.r.t. the DFS numbering) that is connected via a back-edge to a descendant of , i.e., the minimum vertex in the set . Define the “high point”, , of , as the maximum proper ancestor of which is connected with a back-edge to a descendant of . The notion of low points plays central role in classic algorithms for computing the biconnected components [18] and the triconnected components [12] of a graph. The low points of all vertices can be computed in linear time. Hopcroft and Tarjan [12] also use a concept of high points, which, however, is different from ours. Since is -vertex-connected, has a unique child vertex in . For any vertex , define to be the maximum proper ancestor of which is connected with a back-edge to a descendant of . Finally, for any vertex , define to be the nearest common ancestor of all descendants of that are connected with a back-edge to a proper ancestor of . For any vertex , define as the maximum common ancestor of all descendants of that are connected with a back-edge to a proper ancestor of . Next, we show how to compute , , and , for all vertices , in total linear time.

4.2 Finding all and in linear time

The basic idea to compute all (for ) is to do the following: We process the back-edges in decreasing order with respect to their lower end . When we process , we ascent the path , and for each visited vertex such that is still undefined, we set . See Algorithm 1. It should be clear that this process, which forms the basis of our linear-time algorithm, computes all , for , correctly.

1 foreach vertex  do set sort the back-edges in decreasing order w.r.t. to their lower end foreach back-edge  do
2       while  do
3             if  then 
4       end while
5      
6 end foreach
Algorithm 1 High

In order to achieve linear running time, we have to be able, when we consider a back-edge , to bypass all vertices on the path whose value has been computed. To that end, it suffices to know, for every vertex in , the nearest ancestor of whose value is still null. We can achieve this by applying a disjoint-set-union (DSU) structure [19].

Specifically, we maintain a forest that is a subgraph of , subject to the following operations:

:

Adds the edge into the forest .

:

Return the root of the tree in that contains .

Let denote the tree of that contains a vertex . Initially, contains no edges, so is the unique vertex in . In our algorithm, the link operation always adds some tree edge to , so the invariant that is a subgraph of is maintained. This is implemented by uniting the corresponding sets of and in the underlying DSU structure, and setting the root of of as the representative of the resulting set. Then, returns the root of , which will be the nearest ancestor of in whose value is still null. Algorithm 2 gives a fast algorithm for computing , for every vertex .

1 initialize a forest with and foreach vertex  do set sort the back-edges in decreasing order w.r.t. to their lower end foreach back-edge  do
2       while  do
3            
4       end while
5      
6 end foreach
Algorithm 2 FastHigh

The next lemma summarizes the properties of Algorithm 2.

Lemma 4.5.

Algorithm 2 is correct. Furthermore, it will perform and operations on a -vertex-connected graph with vertices and edges.

Proof.

Let be the sorted list of the back-edges. (Notice that contains edges.) We will prove the theorem inductively by showing that, for every in : if, after having run the algorithm for the first back-edges, we now have that, (1) for every vertex , returns the nearest ancestor of whose h value is still null, (2) for every back-edge in , has been computed correctly for every in , and the value of every other vertex, which does not belong to such a set, is still null, and (3) every set that has been formed due to the operations that have been performed is a subtree of , of whose members only its root has its value still set to null, then, if we run the algorithm once more for the back-edge, properties (1), (2) (for ), and (3) will still hold true.

For the basis of our induction, let us note that the premise of the inductive proposition for is trivially true: Before we have begun traversing , the set containing is a singleton, , and is null, for every vertex . Now, suppose the premise of the inductive proposition is true for some in , and let be the back-edge. Let , in decreasing order, be the vertices in whose value is still null. (Note that, since is sorted in decreasing order w.r.t the lower end-point of its elements, we have .) We observe two facts. First, by (1), we have that , and , for . Second, (2) implies that the correct value of , for every , is (although now it is still set to null). From these two facts we can see that, in order to prove that our algorithm is going to correctly compute the values , for , and not mess with those that have already been computed, it is sufficient to show that the function , in line 2, will return, every time it is invoked, the closest ancestor of whose value is still set to null - despite all the operations which might have been performed in the meantime. To see this, observe that (1) and (3) imply that, for every , and belong to different sets (since , having its value still set to null, is the root of the set it belongs to). From this we conclude, that after linking with , and still belong to different sets, for every . It should be clear now that, by executing our algorithm for the back-edge, only the values of are going to be affected (and computed correctly). This shows that (2) (for ) still holds true. We also see that all the sets that have been formed due to the operations that have been performed are still subtrees of , since every such operation is linking a vertex with its parent. Now, let be a vertex that belongs to one of the sets that have been affected by the operations that have been performed during the execution of the algorithm for the back-edge. By (1), this means that, before running the algorithm for this back-edge, , for some . We conclude, that after running the algorithm for the back-edge, the closest ancestor of that has its value still set to null is (since, now, every vertex in has its value computed). This shows that (1) still holds true. Furthermore, this also shows that every vertex in is part of the same set. We conclude that the root of the set which contains is . Thus we have shown that (3) still holds true. (We do not have to consider the vertices whose set has not been affected by the operations.)

Thus we have proved that, since the premise of the inductive proposition for is true, (2) in the conclusion of the inductive proposition for is also true. In other words, our algorithm computes correctly the value of every which belongs to a set of the form , for some back-edge . Since the graph is -vertex-connected, every vertex belongs to such a set. Furthermore, after the execution of the algorithm, precisely operations (one for every vertex ), and operations (one for every end-point of every back-edge, and one for every vertex ) will have been performed. ∎

Since all the operations we perform are of the type , and the total number of and operations performed is , we may use the static tree DSU data structure of Gabow and Tarjan [6] to achieve linear running time.

Finally, we note that the algorithm for computing all is almost identical to Algorithm 2. The only difference is in line 2, where we have to replace “while ” with “while ”. The proof of correctness and linearity is essentially the same.

4.3 Finding all and in linear time

Recall that is the nearest common ancestor of all descendants of that are connected with a back-edge to a proper ancestor of , while is the nearest common ancestor of all descendants of that are connected with a back-edge to a proper ancestor of .

Before we describe our algorithm for the computation of (and ), we state a lemma that will be useful in what follows.

Lemma 4.6.

Let and be such that is an ancestor of and is a descendant of . Then is a descendant of .

Proof.

Let be a back-edge with a descendant of and a proper ancestor of . Since is an ancestor of , is a proper ancestor of . And since is a descendant of , is a descendant of . Now, it is an immediate consequence of the definition of , that is an ancestor of . Since was chosen arbitrarily, we conclude that is an ancestor of . ∎

Remark 4.7.

We note that the lemma still holds if we replace with .

Our algorithm for the computation of works recursively on the children of . So, let be a vertex (different from ). We define . (Of course, we have .) Now, if , we have . (Let us note here that, if is a leaf, then is necessarily true, since the graph is -vertex-connected, and therefore we may set for all vertices that are leaves.) Furthermore, if there exist two children , of such that and , then, again, . The difficulty arises when there is only one child of with the property (one such child of must of necessity exist, since the graph is -vertex-connected), in which case is a descendant of , and, therefore, is a descendant of by Lemma 4.6. In this case, we repeat the same process in : we shall test whether or whether there exists only one child of such that , in which case we repeat the same process in , and so on.

Now, we claim that a careful implementation of the above procedure yields a linear-time algorithm for the computation of , for all vertices . To that end, it suffices to store, for every vertex that is not a leaf of , two pointers, and , on the list of the children of . Initially, points to the first child of that has , and points to the last child of that has . Our algorithm works in a bottom-up fashion. Provided we have computed for every descendant of , we execute Procedure LABEL:proc:findM.

algocf[!h]    

Lemma 4.8.

By executing Procedure LABEL:proc:findM, for all vertices , in bottom-up fashion of , we can compute all in linear-time.

Proof.

To prove correctness, it is sufficient show that, for the computation of , if lies in , for some descendant of , and , then every back-edge that starts from and ends in a proper ancestor of has its starting-point in a subtree of the form , where is a child of between and . It’s easy to see this inductively: that is, let be a vertex, all of whose descendants had this property as the algorithm was running. Now, suppose that is a descendant of such that lies in . If points to the first child of and to the last child of , then there is nothing to prove. But if one of these two pointers was moved (in lines or ) during the execution of the algorithm, this means, thanks to the inductive hypothesis, that for an ancestor of which is also a proper descendant of it is true that every back-edge that starts from and ends in a proper ancestor of has its starting-point in a subtree of the form , for some child of between and . Now we see why every back-edge that starts from and ends in a proper ancestor of has its starting-point in a subtree of the same form: for if this is not the case, and there exists a back-edge that starts from , for some child of which is not between and , and ends in a proper ancestor of , then this is also a back-edge that starts from and ends in a proper ancestor of - a contradiction.

Now, to prove linearity, we note that the only way our algorithm could be making an excessive amount of steps, would be by visiting some vertices a lot of times, when it recursively descends to the descendants of some vertices, in order to compute their value. So we define, for every vertex , the (possibly empty) list of the proper descendants of that the algorithm had to visit in order to compute , sorted by the order of visit (i.e. ordered increasingly). We will prove linearity by showing that two such distinct lists can meet only in their last element. Equivalently, we may show that a non-last member of such a list (let us call it: an intermediary member), can appear only in that same list. So, let be an intermediary member of a list , for some vertex , and let be the first vertex in whose list appears as an intermediary member (that is, there is no proper descendant of in whose list appears as an intermediary member). We note, that, since is an intermediary member of , is a proper descendant of . Now, suppose that there exists a proper ancestor of such that is a member of , and let be the closest proper ancestor of that has this property. Then we have , and there is a unique child of with the property . Furthermore, (the first member of ) belongs to . But does not belong to : for otherwise, since is an ancestor of , Lemma 4.6 implies that is a descendant of , which is a proper descendant of . We conclude, that , the first member of , is an ancestor of . Now, continuing in this fashion, (i.e. considering the unique child of that has the property , so that is the second member of ), we see that the members of are either ancestors of or descendants of . A contradiction. ∎

We use a similar algorithm in order to compute all . The only change we have to make in Procedure LABEL:proc:findM is to replace every comparison to with a comparison to . The proof of correctness and linearity is essentially the same.

5 Finding all vertices that belong to a vertex-edge cut-pair

Let be a -vertex-connected undirected graph. For every in , we define : is a cut-pair. We will find all vertices which belong to a vertex-edge cut-pair of by computing all . We notice that the parameter is also useful for counting TSCC, as Lemma 5.1 suggests. Thus, Corollary 4.3 follows.

Lemma 5.1.

Let be a twinless strongly connected graph, and let be a twinless strong articulation point of which is not a strong articulation point. Then (computed in the -vertex-connected component of in ) is the number of twinless connected components of .

Proof.

Since is not a strong articulation point, is strongly connected. It has been proved in [17], that the twinless strongly connected components of a strongly connected graph correspond to the -edge-connected components of its underlying graph. Now, the number of the -edge-connected components of equals the number of its bridges + (this is due to the tree structure of the -edge-connected components of a connected graph). By Lemma 4.1, all these bridges lie in the -vertex-connected component of in . By definition, their number is . ∎

Now, to compute all , we will work on the tree structure , with root , provided by a DFS on . Then, if is a vertex-edge cut-pair, can either be a back-edge, or a tree-edge. Furthemore, in the case that is a tree-edge, we have the following:

Lemma 5.2.

If is a cut-pair such that is a tree-edge, then either lies in or on the simple tree path .

Proof.

Suppose that is neither in nor on the path . Since is a tree-edge, it has the form , for some vertex . Since is -vertex-connected, there exists a back-edge joining a vertex from with a proper ancestor of . Now, remove and from the graph. Since does not lie on the path , is not a descendant of , and therefore remains connected. Furthermore, since is not in , remains connected with . The existence of implies that remains connected with - a contradiction. ∎

Thus we have three distinct cases in total, and we will compute by counting the cut-pairs in each case. We will handle these cases separately, by providing a specific algorithm for each one of them, based on some simple observations like Lemma 5.2. The linearity of these algorithms will be clear.

Now, we shall begin with the case where is a back-edge, since this is the easiest to handle. We suppose that all have been initialized to zero.

5.1 The case where is a back-edge

Proposition 5.3.

If is a cut-pair such that is a back-edge, then starts from the subtree of a child of , ends in a proper ancestor of , and is the only back-edge that starts from and ends in a proper ancestor of . Conversely, if is such a back-edge, then is a cut-pair.

1 initialize all and to sort the back-edges in increasing order w.r.t. their higher end sort the list of the children of every vertex in increasing order foreach vertex  do
2       if  is not childless then  first child of
3 end foreach
4foreach back-edge  do
5       while  is not an ancestor of  do next child of
6 end foreach
Algorithm 3 Calculating and

This immediately suggests an algorithm for counting all such cut-pairs. We only have to count, for every vertex ( or the child of ), the number back-edges that start from and end in a proper ancestor of . To do this efficiently, we define, for every vertex , back-edges that start from and end in an ancestor of , and, for every child of (if it has any), back-edges that start from and end in . See Algorithm 3. Now, can be computed recursively: if are the children of , then ; and if is childless, . Finally, the number of vertex-edge cut-pairs where is a back-edge, equals the number of children of that have .

5.2 The case where is part of the simple tree path

Let be a vertex-edge cut-pair such that is part of the simple tree path . Then there exists a vertex which is a proper ancestor of and such that . We observe that all back-edges that start from and end in a proper ancestor of must necessarily start from . In other words, is a descendant of . Here we further distinguish two cases, depending on whether is a proper descendant of .

5.2.1 The case

Our algorithm for this case is based on the following observation:

Proposition 5.4.

Let be the children of (if it has any), and let be a cut-pair such that is an ancestor of with . Then does not belong in any set of the form , for . Conversely, given that is a proper ancestor of such that , and given also that does not belong in any set of the form , for , we may conclude that the pair is a cut-pair. (See Figure 3.)

Proof.

() Suppose that belongs to , for some child of . Then is a descendant of , is an ancestor of , and both of these vertices are proper ancestors of . Now, there exists a back-edge , with in . There also exists a back edge , with in . Therefore, it should be clear that the removal of both and does not disconnect from : for, even after this removal, both and remain connected with the subtree . This contradicts the fact that is a cut-pair.
() Remove the vertex and the edge . means that there are no back-edges with being a descendant of a vertex in , but not a descendant of , and an ancestor of . Therefore, if remains connected with , they must both be connected with a subtree , for some child of . Furthermore, if such is the case, there must exist two back-edges, and , and a child of , such that both and are in , is proper ancestor of and a descendant of , and is an ancestor of . But this means that and . In other words: is in - a contradiction. ∎

[trim=0cm 0cm 0cm 8cm, scale=0.8,clip, width=]M_u_v.pdf

Figure 3: and forms a cut-pair with .

Algorithm 4 describes how we can count, for every vertex , all cut-pairs of the form , where is a proper ancestor of with .

1 calculate all lists , for all vertices , and have their elements sorted in decreasing order sort the list of the children of every vertex in decreasing order w.r.t. the value of its elements foreach vertex  do
       if  then continue second element of // the first element of is
2       first child of while  and  do
3             while  and  do
4                   next element of
5             end while
6             next child of while  and  do
7                   if  then  next child of
8             end while
9            while  and  do next element of
10       end while
11      while  do
12             if  then  next element of
13       end while
14      
15 end foreach
Algorithm 4
Theorem 5.5.

Algorithm 4 is correct.

Proof.

By Proposition 5.4, we only have to count, for every vertex , the vertices in that have and are not contained in any set of the form , for any child of . We do this by finding, in a sense, all maximal subsets of of the form , which do not meet any set , for any child of , and we count all elements of . If is the list of the children of sorted in decreasing order w.r.t. their point, then the first such set is , the last one is , where is a child of with minimal among the children of , and all intermediary sets have the form , for some children of . If is childless, we only have to count the elements of . ∎

5.2.2 The case where is a proper descendant of

In this case, belongs to , for a child of , and so we have that is a cut-pair. We base our algorithm for this case on the following observation:

Proposition 5.6.

Let be a cut-pair, such that is an ancestor of and is in . Then and . Conversely, if is a proper ancestor of such that and , then the pair is a cut-pair. (See Figure 4.)

Proof.

() Let be a back-edge such that is in and is a proper ancestor of . Since is in , is in . Furthermore, since is an ancestor of , is a proper ancestor of . This shows that is an ancestor of . Conversely, let be a back-edge such that is in and is a proper ancestor of . Since is a descendant of , is in . Furthermore, since is a cut-pair, must be a proper ancestor of . (For otherwise, we can easily see that, by removing the vertex and the edge , remains connected with , since there exists a back-edge connecting a vertex from (which is a subtree of ) with , which is an ancestor of .) This means that is a descendant of , and this shows that is a descendant of . We conclude that . Finally, since is a cut-pair, it should be clear that must be a proper ancestor of (the argument is the same as in the parenthesis).
() Let’s remove the vertex and the edge . Now, if there exists a path connecting to , this path should contain at least one back-edge such that either (1) is in and is in , or (2) is a descendant of some vertex in , but not a descendant of , and is an ancestor of . (1) cannot be true, since . (2) cannot be true, since is in . We conclude that has been disconnected from . ∎

1 calculate all lists and , for all vertices , and have their elements sorted in decreasing order foreach vertex  do
2       first element of first element of while  and  do
3             while  and  do  next element of if  then break if  then
4                   while  and  do
5                         next element of
6                   end while
7                   predecessor of in next element of while  and  do
8                         while  do
9                               next element of
10                         end while
11                         next element of
12                   end while
13                  
14             end if
15            else
16                   next element of
17             end if
18            
19       end while
20      
21 end foreach
Algorithm 5

Algorithm 5 describes how we can compute, for every vertex , the number of cut-pairs of the form , where is a proper ancestor of with in for a child of .

[trim=0cm 0cm 0cm 9cm, scale=0.8,clip, width=]M_u__v.pdf

Figure 4: is in and forms a cut-pair with .
Theorem 5.7.

Algorithm 5 is correct.

Proof.

According to Proposition 5.6, for every cut-pair of the form