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 lineartime 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 edgeconnected if it has no strong bridges, and it is vertexconnected 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 edgeconnected (resp., vertexconnected), and there is no set of vertices with such that is also edgeconnected (resp., vertexconnected), then is a maximal edgeconnected (resp., vertexconnected) subgraph of . Two vertices are said to be edgeconnected (resp., vertexconnected) if there are two edgedisjoint (resp., two internally vertexdisjoint) directed paths from to and two edgedisjoint (resp., two internally vertexdisjoint) directed paths from to (note that a path from to and a path from to need not be edge or vertexdisjoint). A edgeconnected component (resp., vertexconnected component) of a digraph is defined as a maximal subset such that every two vertices are edgeconnected (resp., vertexconnected). We note that connectivityrelated 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 vertexconnected components of digraphs in linear time [7, 8], while the best current bound for computing the maximal edge and the vertexconnected subgraphs in digraphs is not even linear, but it is [3, 11].
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 lineartime algorithm for detecting all twinless strong bridges can be derived by combining the lineartime algorithm of Italiano et al. [13] for computing all the strong bridges of a digraph and the lineartime algorithm of Tsin [20] for computing the edgeconnected 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 lineartime 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 vertexconnected (biconnected) undirected graph , find all vertices that belong to a vertexedge cut pair, i.e., for which there exists an edge such that is not connected. We develop a lineartime algorithm that not only finds all such vertices , but also computes the number of vertexedge 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 depthfirst 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 vertexedge 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 edgeconnected 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 edgeconnected.
Theorem 2.1 implies a lineartime algorithm to compute the twinless strongly connected components (TSCCs) of a digraph . It suffices to compute the strongly connected components, , of and compute the edgeconnected 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 edgeconnected.
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 edgeconnected. Now, since the initial graph is twinless strongly connected, its underlying undirected graph is edgeconnected, 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 cutpair, 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 cutpair in a edgeconnected 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 lineartime algorithm for computing all the edges that belong to a cutpair in a edgeconnected undirected graph. Our algorithm also counts, for every edge , all edges such that is a cutpair. 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 cutpair 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 edgeconnected. 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 vertexconnected component of separately, as the next lemma suggests.
Lemma 4.1.
Let be a edgeconnected undirected graph. Let be a vertex that is not an articulation point, and let be its vertexconnected component (2VCC). For any edge , is not connected if and only if belongs to and is not connected.
Proof.
() Since is edgeconnected, it contains no bridges. Therefore, every 2VCC of contains at least three vertices, and thus it is a vertexconnected 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 vertexconnected, is must also be edgeconnected, 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 vertexconnected undirected graph , find all vertices for which there exists an edge such that is not connected. Next, we describe a lineartime algorithm for this problem. Our algorithm utilizes properties of depthfirst 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 lineartime 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 Depthfirst search, low and high points
Let be a vertexconnected 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 treeedges; the edges in are called backedges, as their endpoints have ancestordescendant relation in . When we write to denote a backedge, we always mean that , i.e., is an descendant of in .
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 welldefined, for is vertexconnected. Define the “low point”, , of a vertex , as the minimum vertex (w.r.t. the DFS numbering) that is connected via a backedge 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 backedge 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 vertexconnected, has a unique child vertex in . For any vertex , define to be the maximum proper ancestor of which is connected with a backedge to a descendant of . Finally, for any vertex , define to be the nearest common ancestor of all descendants of that are connected with a backedge to a proper ancestor of . For any vertex , define as the maximum common ancestor of all descendants of that are connected with a backedge 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 backedges 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 lineartime algorithm, computes all , for , correctly.
In order to achieve linear running time, we have to be able, when we consider a backedge , 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 disjointsetunion (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 .
The next lemma summarizes the properties of Algorithm 2.
Lemma 4.5.
Algorithm 2 is correct. Furthermore, it will perform and operations on a vertexconnected graph with vertices and edges.
Proof.
Let be the sorted list of the backedges. (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 backedges, we now have that, (1) for every vertex , returns the nearest ancestor of whose h value is still null, (2) for every backedge 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 backedge, 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 backedge. 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 endpoint 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 backedge, 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 backedge. By (1), this means that, before running the algorithm for this backedge, , for some . We conclude, that after running the algorithm for the backedge, 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 backedge . Since the graph is vertexconnected, 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 endpoint of every backedge, 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.
4.3 Finding all and in linear time
Recall that is the nearest common ancestor of all descendants of that are connected with a backedge to a proper ancestor of , while is the nearest common ancestor of all descendants of that are connected with a backedge 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 backedge 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 vertexconnected, 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 vertexconnected), 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 lineartime 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 bottomup 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 bottomup fashion of , we can compute all in lineartime.
Proof.
To prove correctness, it is sufficient show that, for the computation of , if lies in , for some descendant of , and , then every backedge that starts from and ends in a proper ancestor of has its startingpoint 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 backedge that starts from and ends in a proper ancestor of has its startingpoint in a subtree of the form , for some child of between and . Now we see why every backedge that starts from and ends in a proper ancestor of has its startingpoint in a subtree of the same form: for if this is not the case, and there exists a backedge that starts from , for some child of which is not between and , and ends in a proper ancestor of , then this is also a backedge 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 nonlast 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 vertexedge cutpair
Let be a vertexconnected undirected graph. For every in , we define : is a cutpair. We will find all vertices which belong to a vertexedge cutpair 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 vertexconnected 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 edgeconnected components of its underlying graph. Now, the number of the edgeconnected components of equals the number of its bridges + (this is due to the tree structure of the edgeconnected components of a connected graph). By Lemma 4.1, all these bridges lie in the vertexconnected 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 vertexedge cutpair, can either be a backedge, or a treeedge. Furthemore, in the case that is a treeedge, we have the following:
Lemma 5.2.
If is a cutpair such that is a treeedge, then either lies in or on the simple tree path .
Proof.
Suppose that is neither in nor on the path . Since is a treeedge, it has the form , for some vertex . Since is vertexconnected, there exists a backedge 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 cutpairs 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 backedge, since this is the easiest to handle. We suppose that all have been initialized to zero.
5.1 The case where is a backedge
Proposition 5.3.
If is a cutpair such that is a backedge, then starts from the subtree of a child of , ends in a proper ancestor of , and is the only backedge that starts from and ends in a proper ancestor of . Conversely, if is such a backedge, then is a cutpair.
This immediately suggests an algorithm for counting all such cutpairs. We only have to count, for every vertex ( or the child of ), the number backedges that start from and end in a proper ancestor of . To do this efficiently, we define, for every vertex , backedges that start from and end in an ancestor of , and, for every child of (if it has any), backedges 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 vertexedge cutpairs where is a backedge, equals the number of children of that have .
5.2 The case where is part of the simple tree path
Let be a vertexedge cutpair 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 backedges 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 cutpair 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 cutpair. (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 backedge , 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 cutpair.
() Remove the vertex and the edge . means that there are no backedges 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 backedges, 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.
∎
Algorithm 4 describes how we can count, for every vertex , all cutpairs of the form , where is a proper ancestor of with .
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 cutpair. We base our algorithm for this case on the following observation:
Proposition 5.6.
Let be a cutpair, 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 cutpair. (See Figure 4.)
Proof.
() Let be a backedge 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 backedge such that is in and is a proper ancestor of . Since is a descendant of , is in . Furthermore, since is a cutpair, 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 backedge 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 cutpair, 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 backedge 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 .
∎
Algorithm 5 describes how we can compute, for every vertex , the number of cutpairs of the form , where is a proper ancestor of with in for a child of .
Theorem 5.7.
Algorithm 5 is correct.
Proof.
According to Proposition 5.6, for every cutpair of the form
Comments
There are no comments yet.