Incremental Strong Connectivity and 2-Connectivity in Directed Graphs

02/27/2018 ∙ by Loukas Georgiadis, et al. ∙ 0

In this paper, we present new incremental algorithms for maintaining data structures that represent all connectivity cuts of size one in directed graphs (digraphs), and the strongly connected components that result by the removal of each of those cuts. We give a conditional lower bound that provides evidence that our algorithms may be tight up to sub-polynomial factors. As an additional result, with our approach we can also maintain dynamically the 2-vertex-connected components of a digraph during any sequence of edge insertions in a total of O(mn) time. This matches the bounds for the incremental maintenance of the 2-edge-connected components of a digraph.

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

A dynamic graph algorithm aims at updating efficiently the solution of a problem after each update, faster than recomputing it from scratch. A dynamic graph problem is said to be fully dynamic if the update operations include both insertions and deletions of edges, and it is said to be incremental (resp., decremental) if only insertions (resp., deletions) are allowed. In this paper, we present new incremental algorithms for some basic connectivity problems on directed graphs (digraphs), which were recently considered in the literature [20]. Before defining the problems and stating our bounds, we need some definitions.

Let be a digraph. is strongly connected if there is a directed path from each vertex to every other vertex. The strongly connected components (in short SCCs) of are its maximal strongly connected subgraphs. Two vertices are strongly connected if they belong to the same SCC of . An edge (resp., a vertex) of is a strong bridge (resp., a strong articulation point) if its removal increases the number of SCCs in the remaining graph. See Figure 1. Given two vertices and , we say that an edge (resp., a vertex) of is a separating edge (resp., a separating vertex) for and if its removal leaves and in different SCCs. Let be strongly connected: is -edge-connected (resp., -vertex-connected) if it has no strong bridges (resp., no strong articulation points). Two vertices are said to be -edge-connected (resp., -vertex-connected), denoted by (resp., ), if there are two edge-disjoint (resp., internally vertex-disjoint) directed paths from to and two edge-disjoint (resp., internally vertex-disjoint) directed paths from to . (Note that a path from to and a path from to need not be edge-disjoint or internally vertex-disjoint). A -edge-connected component (resp., a -vertex-connected component) of a digraph is defined as a maximal subset such that (resp., ) for all . Given a digraph , we denote by (resp., ) be the digraph obtained after deleting edge (resp., vertex ) from .

Figure 1: A strongly connected digraph with strong bridges shown in red (better viewed in color), and the SCCs of after the deletion of the strong bridge .

Let be a strongly connected graph. In very recent work [20], we presented an -space data structure that, after a linear-time preprocessing, is able to answer in asymptotically optimal (worst-case) time all the following queries on a static digraph:

  • Report in time the total number of SCCs in (resp., ), for any query edge (resp., vertex ) in .

  • Report in time the size of the largest and of the smallest SCCs in (resp., ), for any query edge (resp., vertex ) in .

  • Report in time all the SCCs of (resp., ), for any query edge (resp., vertex ).

  • Test in time whether two query vertices and are strongly connected in (resp., ), for any query edge (resp., vertex ).

  • For any two query vertices and that are strongly connected in , report all edges (resp., vertices ) such that and are not strongly connected in (resp., ) in time , where is the number of separating edges (resp., separating vertices).

As pointed out in [20, 37], this data structure is motivated by applications in many areas, including computational biology [21, 34] social network analysis [30, 44], network resilience [40] and network immunization [4, 7, 32].

A dynamic version of the aforementioned data structure can be used to monitor the critical components (i.e., edges and vertices) whose removal disrupts the underlying graphs, in graphs that change over time. An ideal scenario is to design efficient algorithms in the fully dynamic setting. However, we show that no data structure that can answer any of the queries that we consider in sublinear time in the number of edges, can be maintained faster than recomputing the data structure from scratch unless a widely believed conjecture is proved wrong. There are real-word dynamic networks where edge deletion occur rarely, in which case the incremental setting finds applications. Such networks include, for instance, communication networks, road networks, the power grid.

Our Results. We show a conditional lower bound for the fully dynamic version of this problem. More specifically, let be a digraph with vertices that undergoes edge updates from an initially empty graph. We prove that any fully dynamic algorithm that can answer any of the queries considered here requires either amortized update time, or query time, unless the Strong Exponential Time Hypothesis [27, 28] is false.

Motivated by this hardness result, we focus on the incremental version of this problem. We present an incremental version of the data structure introduced in [20], which can be maintained throughout a sequence of edge insertions. In particular, we show how to maintain a digraph undergoing edge insertions in a total of time, where is the number of vertices and the number of edges after all insertions, so that all the queries we consider can be answered in asymptotically optimal (worst-case) time after each insertion. As an additional result, with our approach we can also maintain the -vertex-connected components of a digraph during any sequence of edge insertions in a total of time. After every insertion we can test whether two query vertices are -vertex-connected and, whenever the answer is negative, produce a separating vertex (or an edge) for the two query vertices. This matches the bounds for the incremental maintenance of the -edge-connected components of a digraph [19].

Before our work, no algorithm for all those problems was faster than recomputing the solution from scratch after each edge insertion, which yields a total of . Our algorithms improve substantially over those bounds. In addition, we show a conditional lower bound for the total update time of an incremental data structure that can answer queries of the form “are and strongly connected in ”, where , . In particular, we prove that the existence of a data structure that supports the aforementioned queries with total update time (for some constant ). Therefore, a polynomial improvement of our bound leads to a breakthrough.

Related Work. Many efficient algorithms for several dynamic graph problems have been proposed in the literature, including dynamic connectivity [24, 26, 35, 36, 42], minimum spanning trees [12, 14, 25, 26, 35], edge/vertex connectivity [12, 26] on undirected graphs, and transitive closure [10, 23, 31, 39] and shortest paths [2, 9, 31, 43] on digraphs. Dynamic problems on digraphs are known to be harder than on undirected graphs and most of the dynamic algorithms on undirected graphs have polylog update bounds, while dynamic algorithms on digraphs have higher polynomial update bounds. The hardness of dynamic algorithms on digraphs has been recently supported also by conditional lower bounds [1].

In [15], the decremental version of the data structure considered in this paper is presented. The total time and space required to maintain decrementally the data structure is and , respectively: here is the number of edges in the initial graph. We remark that our incremental algorithms are substantially different from decremental algorithms of [15], and indeed the techniques that we use here are substantially different from [15]. More specifically, the main approach of [15] is to maintain the SCCs in for each , by carefully combining appropriate instances of the decremental SCCs algorithm from [33]. This allows to maintain decrementally the dominator tree in total time and space. On the contrary, in the incremental setting it is already known how to maintain dominator trees, and the main challenge is to maintain efficiently information about nesting loops throughout edge insertions. This allows us to achieve better bounds than in the decremental setting [15]: namely, total time and space.

In [19] we presented an incremental algorithm that maintains the -edge-connected components of a directed graph with vertices through any sequence of edge insertions in a total of time, where is the number of edges after all insertions. After each insertion, we can test in constant time if two query vertices and are -edge-connected, and if not we can produce in constant time a “witness” of this property, by exhibiting an edge that is contained in all paths from to or in all paths from to .

Our Technical Contributions. Our fist contribution is to dynamize the recent data structure in [20], which hinges on two main building blocks: dominator trees and loop nesting trees (which are reviewed in Section 2). While it is known how to maintain efficiently dominator trees in the incremental setting [18], the incremental maintenance of loop nesting trees is a challenging task. Indeed, loop nesting trees are heavily based on depth-first search, and maintaining efficiently a dfs tree of a digraph under edge insertions has been an elusive goal: no efficient solutions are known up to date, and incremental algorithms are available only in the restricted case of DAGs [13]. To overcome these inherent difficulties, we manage to define a new notion of strongly connected subgraphs of a digraph, which is still relevant for our problem and is independent of depth first search. This new notion is based on some specific nesting loops, which define a laminar family. One of the technical contributions of this paper is to show how to maintain efficiently this family of nesting loops during edge insertions. We believe that this result might be of independent interest, and perhaps it might shed further light to the incremental dfs problem on general digraphs.

Our second contribution, the incremental maintenance of the -vertex-connected components of a digraph, completes the picture on incremental -connectivity on digraphs by complementing the recent -edge connectivity results of [19]. We remark that -vertex connectivity in digraphs is much more difficult than -edge connectivity, since it is plagued with several degenerate special cases, which are not only more tedious but also more cumbersome to deal with. For instance, -edge-connected components partition the vertices of a digraph, while -vertex-connected components do not. Furthermore, two vertices and are -edge-connected if and only if the removal of any edge leaves and in the same SCC. Unfortunately, this property no longer holds for -vertex connectivity, as for instance two mutually adjacent vertices are always left in the same strongly connected component by the removal of any other vertex, but they are not necessarily -vertex-connected.

2 Dominator trees, loop nesting trees and auxiliary components

In this section we review the two main ingredients used by the recent framework in [20]: dominator trees and loop nesting trees. As already mentioned in the introduction, one of the main technical difficulties behind our approach is that the incremental maintenance of loop nesting trees seems an elusive goal. We then review the notion of auxiliary components, which is used in Section 3 to overcome this difficulty. We remark that both dominator trees and auxiliary components can be maintained efficiently during edge insertions [18, 19].

Throughout, we assume that the reader is familiar with standard graph terminology, as contained for instance in [8]. Given a rooted tree, we denote by the set of descendants of in . Given a digraph , and a set of vertices , we denote by the subgraph induced by . Moreover, we use and to refer to the vertices of and to the edges adjacent to , respectively. The reverse digraph of , denoted by , is obtained by reversing the direction of all edges. A flow graph is a directed graph (digraph) with a distinguished start vertex , where all vertices in are reachable from in . We denote by the subgraphs of induced by the vertices that are reachable from ; that is, is a flow graph with start vertex . Respectively, we denote by the subgraphs of induced by the vertices that are reachable from . If is strongly connected, all vertices are reachable from and reach , so we can view both and as flow graphs with start vertex .

Dominator trees. A vertex is a dominator of a vertex ( dominates ) if every path from to contains . The dominator relation in can be represented by a tree rooted at , the dominator tree , such that dominates if and only if is an ancestor of in . See Figure 2. We denote by the set of vertices that dominate . Also, we let denote the parent of a vertex in . Similarly, we can define the dominator relation in the flow graph , and let denote the dominator tree of , and the parent of in . The dominator tree of a flow graph can be computed in linear time, see, e.g., [3, 6]. An edge is a bridge of a flow graph if all paths from to include .111Throughout the paper, to avoid confusion we use consistently the term bridge to refer to a bridge of a flow graph and the term strong bridge to refer to a strong bridge in the original graph. Let be an arbitrary start vertex of . As shown in [29], an edge is strong bridge of if and only if it is either a bridge of or a bridge of . As a consequence, all the strong bridges of can be obtained from the bridges of the flow graphs and , and thus there can be at most strong bridges overall.

Figure 2: The dominator tree (on the left) of the digraph of Figure 1 with start vertex , and its bridge decomposition (on the right).

After deleting from the dominator trees and respectively the bridges of and , we obtain the bridge decomposition of and into forests and . Throughout the paper, we denote by (resp., ) the tree in (resp., ) containing vertex , and by (resp., ) the root of (resp., ). The following lemma from [17] holds for a flow graph of a strongly connected digraph (and hence also for the flow graph of ).

Lemma 2.1.

([17]) Let be a strongly connected digraph and let be a strong bridge of . Also, let be the dominator tree of the flow graph , for an arbitrary start vertex . Suppose . Let be any vertex that is not a descendant of in . Then there is path from to in that does not contain any proper descendant of in . Moreover, all simple paths in from to any descendant of in must contain the edge .

Loop nesting forests. Let be a digraph, and the flow graph with an arbitrary start vertex . A loop nesting forest represents a hierarchy of strongly connected subgraphs of  [41], defined with respect to a dfs tree of , rooted at , as follows. For any vertex , is the set of all descendants of in such that there is a path from to in containing only descendants of in . Any two vertices in reach each other. Therefore, induces a strongly connected subgraph of ; it is the unique maximal set of descendants of in that does so. The sets form a laminar family of subsets of : for any two vertices and , and are either disjoint or nested. The loop nesting forest of , with respect to , is the forest in which the parent of any vertex , denoted by , is the nearest proper ancestor of in such that if there is such a vertex , and null otherwise. Then is the set of all descendants of vertex in , which we also denote as (the subtree of rooted at vertex ). A loop nesting forest can be computed in linear time [6, 41]. When is strongly connected, each vertex is contained in a loop, and is a tree, rooted at . Therefore, we refer to as the loop nesting tree of (see Figure 3).

Figure 3: The flow graph of the graph of Figure 1 with solid dfs edges (left); the loop nesting tree of generated by the dfs traversal on the left (middle); the hyperloop nesting tree of (right). The bridges of are shown red. The grouped vertices in both and represent the auxiliary components of .

Auxiliary components. Let be a flow graph and and be the dominator tree and the bridge decomposition of , respectively. Let be a bridge of the flow graph . We say that an SCC in is an -dominated component of . We also say that is a bridge-dominated component if it is an -dominated component for some bridge : bridge-dominated components form a laminar family [19]. An auxiliary component of is a maximal subset of vertices such that is a subset of a -dominated component. Each auxiliary component is represented by an arbitrarily chosen vertex , which we call the canonical vertex of . For each vertex , we refer to the canonical vertex of by . That is, if is the canonical vertex of an auxiliary component then . Following the bridge decomposition of the dominator tree of , the auxiliary components are defined with respect to the start vertex .

3 Hyperloop nesting forest

In this section, we introduce the new notion of hyperloop nesting forest, which, differently from loop nesting forest, can be maintained efficiently during edge insertions, as we show in Section 5. Given a canonical vertex , we define the hyperloop of , and denote it by , as the set of canonical vertices that are in the same -dominated component as . As a special case, all canonical vertices that are strongly connected to are in the hyperloop . It can be shown that hyperloops form a laminar family of subsets of , with respect to the start vertex : for any two canonical vertices and , and are either disjoint or nested (i.e., one contains the other). This property allows us to define the hyperloop nesting forest of as follows. The parent of a canonical vertex in is the (unique) canonical vertex , , with the largest depth in , such that . If there is no vertex , such that , then ; notice that in this case is not strongly connected to as well. See Figure 3. Then, is the set of all descendants of a canonical vertex in , which we also denote as (the subtree of rooted at vertex ). Similarly to the loop nesting forest, the hyperloop nesting forest of a strongly connected digraph is a tree.

Figure 4: A representation of the relation between a canonical vertex and its parent in with respect to the bridge decomposition of .

We begin the study of the hyperloop nesting forest by showing that it is unique, and thus, depends solely on the structure of the graph. (We consider a fixed choice of the canonical vertices of the auxiliary components.)

Lemma 3.1.

The hyperloop nesting forest of a flowgraph is unique.

Proof.

Let be a canonical vertex of . By the definition of the hyperloop nesting forest , the parent of in is the canonical vertex with maximum depth in , such that and are in the same -dominated component. Then, the fact that both and are descendants of implies that is unique and so the lemma follows.

Given a vertex in a flow graph , we define its level, denoted by , to be the number of bridges of such that is an ancestor of in . In other words, the level of equals the number of strong bridges that appear in all paths from to in . As a result, all vertices in the same tree of the bridge decomposition have the same level. In the next lemma we show that each canonical vertex has at most one ancestor in at each level.

Lemma 3.2.

Let a flow graph and let be a canonical vertex of . All ancestors of in the hyperloop nesting forest have unique level.

Proof.

Let and be two distinct ancestors of in such that . By the definition of the hyperloop nesting forest both and are ancestors of in . Then, . Assume by contradiction that is strongly connected with both and in . Then and are strongly connected in . By the definition of the auxiliary components, and are in the same auxiliary component, and thus . A contradiction to the fact that both and are canonical vertices. The lemma follows.

The following lemma characterizes the relationship between the loop nesting forest and the hyperloop nesting forest of a flow graph . More specifically, it shows that can be obtained from by contracting all the vertices of each auxiliary component into their canonical vertex. This yields immediately a linear-time algorithm to compute the hyperloop nesting forest of a flow graph : we first compute a loop nesting forest of [6, 41] and then contract each vertex to in . In the following we denote by the unique ancestor of in , such that and . If , it follows that . We can compute , for all in time [20].

Lemma 3.3.

For every vertex , the following hold:

  • The canonical vertices of and are the same.

  • The canonical vertex of the parent of in is the canonical vertex of the parent of in , including the case where .

Proof.

Let be the dfs traversal that generated . In the case where , it trivially follows that . Now assume that . Note that is an ancestor of in since all paths from to go through by Lemma 2.1. Therefore, also all the descendants of in are descendant of in . The fact that is an ancestor of in it means that is a descendant of in and has a path to using only descendants of in . The path cannot contain vertices that are not in since otherwise by Lemma 2.1 they contain , which contradicts the fact that all vertices on contain descendants of in (recall that is an ancestor of in ). It follows that has a path to in and has a path to in . Thus, by the definition of the auxiliary components. Exactly the same argument can be applied on the reverse graph to show that .

Consider now . In the case where , it trivially follows that . Therefore in the following we assume that . First, we deal with the case where . Since , the only case that this can happen is when . That means, there is no ancestor of in , such that has a path to using only vertices in . We show that this means, there is also no vertex , such that and are strongly connected in . Assume, for the sake of contradiction that there is such vertex , and let be the SCC containing both , and therefore also , and . Moreover, let vertex be the vertex that is visited first by the dfs that generated . Then all vertices in are descendants of in since they are all reachable from and they were not visited by the dfs before . Hence, is a descendant of in . A contradiction to the fact that . Therefore, there is no vertex , such that and are strongly connected in . Thus, . Now we consider the case where . The fact that is an ancestor of in implies that is an ancestor of also in . By the definition of it follows that is a descendant of in , and has a path to using only descendants of in . The path cannot contain vertices that are not in since otherwise, by Lemma 2.1, they contain , which contradicts the fact that all vertices on contain descendants of in (recall that is an ancestor of in ). Therefore and are strongly connected in , and by definition so do and . Hence, is an ancestor of in . Now we show that there is no other canonical vertex such that and is an ancestor of in . This implies that . Assume, for the sake of contradiction, that there is such a vertex . Then and are in the same SCC in . Let be the first among the vertices in visited by the dfs that generated . Then all vertices in are descendants of in since they are all reachable from and they were not visited by the dfs before . Thus, is a descendant of in . Now we show that this implies that is also a descendant of in . By the definition of the hyperloop nesting forest and are ancestors of in . Furthermore, since it holds that is an ancestor of in . By the fact that and are ancestors of in it holds that and have ancestor-descendant relation, and hence, is a descendant of in (as and are ancestors of in and ). Since has a path to using only descendants of in , it follows that also has a path to using only descendants of in . Thus, is a descendant of in . In summary, if an ancestor of and a descendant of in ; a contradiction to the definition of . This concludes the lemma.

4 Updating the dominator tree after an edge insertion

In this section, we briefly review the algorithm from [18] that updates the dominator tree of a flow graph after an edge insertion. Let be a flow graph with start vertex . Let be the edge to be inserted. Let be the dominator tree of before the insertion; we let be the the dominator tree of . In general, for any function on , we let be the function after the update. We say that vertex is -affected by the update if (its parent in ) changes, i.e., . We let denote the nearest common ancestor of and in the dominator tree .

Lemma 4.1.

([38]) If is -affected, then it becomes a child of in , i.e., .

We say that a vertex is -scanned if it is a descendant of a -affected vertex after an edge insertion. Note that every -affected vertex is also -scanned since each vertex is a descendant of itself in . There are two key ideas behind the incremental dominators algorithm. First, the algorithm updates in time proportional to number of the edges incident to -scanned vertices. Second, after an edge insertion, all -scanned vertices decrease their depth in by at least one. Since throughout a sequence of edge insertions the depth of a vertex can only decrease, each vertex can be -scanned at most times, and thus the algorithm examines at most times the adjacency list of each vertex. This implies that the algorithm has total update time, where is the number of edges in the graph after all insertions.

We now prove the following lemma, which shows that after the insertion of an edge , the ancestors and descendants of the vertices do not change. We use this later later on in our incremental algorithm for maintaining the hyperloop nesting forest of a flow graph.

Lemma 4.2.

Let be a vertex that is not a descendant of in . Then and . Moreover, if was a bridge in , then it remains a bridge in .

Proof.

The claim that follows immediately from the fact that all -scanned vertices (which were the only vertices for which ) were in and therefore remain in . This also implies that , as for each it holds that . Now let be a bridge in , and assume by contradiction that is no longer a bridge in . This implies there is a path from to avoiding in . Since was the only incoming edge to , the path in must contain and edge such that . This contradicts the fact that the only new edge is and that either or , as otherwise is an ancestor of in (which we assume is not).

5 Updating the hyperloop nesting forest after an edge insertion

Let be a directed graph and let be the flow graph of with an arbitrary start vertex . In this section we show how to maintain the hyperloop nesting forest of under a sequence of edge insertions. We assume that and are rooted at and , respectively. For simplicity, we also assume that all vertices of are reachable from , so . If this is not true, then we can simply recompute and from scratch, in linear time, every time a vertex becomes reachable from after an edge insertion. Since there can be at most such events, the total running time for these recomputations is .

Throughout the sequence of edge insertions, we maintain as additional data structures only the dominator tree (with the incremental dominators algorithm in [18]), the bridge decomposition and the auxiliary components of (with the algorithm in [19]).

Set to be the designated start vertex of . Compute the dominator tree and the set of bridges of the corresponding flow graph . Compute the bridge decomposition of , and the auxiliary components of . Compute the loop nesting forest of the . Construct the hyperloop nesting forest from by contacting each vertex into .
Algorithm 1 Initialize
Figure 5: A detailed example demonstrating the different types of vertices that we consider after an edge insertion. In (i), a digraph before the insertion of (dashed edge). In (ii), the dominator tree of where vertices in the same auxiliary components are grouped together. In (iii), the hyperloop nesting tree of . In (i)-(iii) we color the -affected with red the -scanned but not -affected vertices with blue, and the -affected but not -scanned vertices with green. Finally, in (iv), (v), and (vi) we represent , where vertices in the same auxiliary components are grouped together, and .

Initialization and restarts. To initialize the algorithm, we compute the dominator tree , bridge decomposition and auxiliary components, which can be done in linear time [3, 19]. We also compute the hyperloop nesting forest of in linear time, as suggested by Lemma 3.3. The pseudocode for the initialization is given in Algorithm 1.

After the first initialization, in some special cases we initialize our algorithm again, in order to simplify the analysis. We call this a restart. We restart our algorithm whenever a bridge of is canceled after the insertion of a new edge but we still have , i.e., is no longer a strong bridge in but the parent of in the dominator tree does not change. In this case, we say that the bridge is locally canceled. This is a difficult case to analyze: the incremental dominators algorithm does not spend any time, since there are no -affected vertices, while the bridge decomposition and the auxiliary components of might change. Fortunately, there are at most locally canceled bridges throughout a sequence of edge insertions [19]. Hence, we restart our algorithm at most times. Consequently, the total time spent in restarts is .

High-level overview of the update. Let be the new edge to be inserted. Similarly to Section 4, for any function , we use the notation to denote the same function after the insertion of , e.g., we denote by , the parent of a canonical vertex in the hyperloop nesting forest, after the insertion of , and by the resulting hyperloop nesting forest. Once again, we denote by -scanned the vertices that decrease their depth in the dominator tree after an edge insertion. Moreover, we denote by -affected the vertices that change their parent in and by -affected the vertices for which it holds , i.e., when the parent of in is not in the same auxiliary component as (the parent of in ). After the insertion of a new edge , if not involved in a restart, our algorithm performs the following updates, as shown in the pseudocode of Algorithm 2:

  • Compute the new dominator tree , the corresponding bridge decomposition , and the new auxiliary components.

  • Compute for the -scanned canonical vertices .

  • Compute for the -scanned canonical vertices .

  • Compute for the -affected canonical vertices that are not -scanned.

As already mentioned, the dominator tree , the bridge decomposition and the auxiliary components of can be maintained during edge insertions within our claimed bounds [18, 19]. To complete the algorithm, it remains to show how to update efficiently the parent in the hyperloop nesting forest of the -scanned and the -affected vertices. This is non-trivial, and the low-level technical details of the method are spelled out in Sections 5.1 and 5.2, respectively. Before giving the details of our algorithm, we show that we only need to consider the vertices .

1 Let be the designated start vertex of , and let . Update the dominator trees . Let be the set of -scanned vertices. Update the bridge decomposition , and the auxiliary components of if a bridge is locally canceled in  then
2       Execute Initialize.
3else
4       Execute Update-D-scanned and Update-L-affected.
5 end if
Algorithm 2 SCInsertEdge
Lemma 5.1.

No canonical vertex is -affected.

Proof.

We have that . Assume . The fact that implies that . By Lemma 4.2, and . Therefore, . As and are not strongly connected in but they are strongly connected in , if follows that either all paths from to or from to in contain . Thus, all paths from or from to in contain . As , by Lemma 2.1, all paths from or to in contain . Note that there is path from to in avoiding (as , and ). A contradiction to the fact that all paths from or from to in contain .

5.1 Updating the -scanned vertices

Let be the set of -scanned vertices containing also the -affected vertices. After the insertion of the edge , all the -affected vertices become children of in , by Lemma 4.1. In this section we deal with the update of the parent in the hyperloop nesting forest , for all canonical vertices . From now on, in order to simplify the notation, we assume without loss of generality that for any vertex of interest ; we also denote by .

After the insertion of the edge only a subset of the ancestors in of an -affected canonical vertex changes. In particular, Lemma 5.2 shows that the ancestors of in such that remain ancestors of in . However, the insertion of might create a new path from to a canonical vertex such that , containing only vertices in . In such a case, becomes an ancestor of in .

Lemma 5.2.

Let be a canonical vertex in . For each ancestor of in , such that , the canonical vertex remains ancestor of in . Moreover, .

Proof.

By Lemma 4.2 and the fact that is an ancestor of , it follows that and remains a bridge in . Then, the fact that is an ancestor of in follows from the fact that and are strongly connected in and .

The following lemma identifies the new parent in of .

Lemma 5.3.

It holds that , where is the nearest ancestor of in such that .

Proof.

By Lemma 5.2, for all ancestors of in , such that , vertex remains ancestor of in . We show that all ancestors of in were ancestors of in before the edge insertion. Assume by contradiction that there exists a canonical vertex that is an ancestor of in , but is not an ancestor of in . By the definition of hyperloop nesting forest, must be a proper ancestor of . Lemma 4.2 and the fact that is not locally canceled imply that , is an ancestor of in , and . Following our assumption we have that and are strongly connected in but not in . Therefore, there is no path from to in . By the fact that , there exists a path from to in avoiding . As , there is a path from to through in avoiding ; a contradiction. The lemma follows.

We now compute for each canonical vertex , that is, the -affected vertices that are in the same tree of the canonical decomposition of with . Note that all the new paths that are introduced by the insertion of the edge must contain . We use this observation to compute , for , based on as shown in the following lemma.

Lemma 5.4.

Let be -scanned. If and are in different auxiliary components then , where is the nearest ancestor of in such that .

Proof.

By Lemma 5.2 for each ancestor of in , such that , vertex remains ancestor of in . Assume by contradiction that with , that is, is a proper ancestor of in . Since , it follows that , and therefore by Lemma 4.2. By our assumption, and are strongly connected in . Lemma 2.1 implies that all paths from to in contain . Let be such a path, where is the subpath from to and the subpath from to . Since, does not contain and we also have that it follows that has a path to in . As and are not strongly connected in , all path from to in contain . Moreover, due to the facts that , any path from to contains a vertex out of , and therefore, also by Lemma 2.1. By the last two arguments, all paths from to contain both first and then . That implies that all paths from to in contain the edge , and as all paths from to in contain (by Lemma 2.1) it follows that all paths from to contain . This is sufficient for to be a bridge in , which is a contradiction as is reachable from in . Thus, our assumption about led us to a contradiction. The lemma follows.

With the help of Lemma 5.4, we can iterate over the vertices setting appropriately. Recall that (the set of -scanned vertices) is provided to us by the incremental dominators algorithm. Next, we deal with the canonical vertices . We begin with the computation of , for the canonical vertices in for which , that is, their new parent in is in . Let be the graph induced by the -scanned vertices, and let be the loop nesting forest rooted at of . (Note that reaches all vertices in .) By contracting every vertex into in , we obtain a forest . Let be the parent in of a canonical vertex . As stated in Lemma 5.5, the parent in of each canonical vertex such that is the parent of in .

Figure 6: Instances of the updated dominator tree after the insertion of . In (i) is a -scanned vertex where . For all such vertices, we apply Lemma 5.5 to compute . In (ii), has a path to in and is -affected, which is sufficient for to be ancestor of in . In (iii) vertex is an ancestor of in , as and are strongly connected in , and therefore remains an ancestor of in