Faster Dynamic -Edge Connectivity in Directed Graphs
Abstract
Let be a directed graph with vertices and edges. We present a deterministic algorithm that maintains the -edge-connected components of under a sequence of edge insertions, with a total running time of . This significantly improves upon the previous best bound of for graphs that are not very sparse. After each insertion, our algorithm supports the following queries with asymptotically optimal efficiency:
-
Test in constant time whether two query vertices and are -edge-connected in .
-
Report in time all the -edge-connected components of .
Our approach builds on the recent framework of Georgiadis, Italiano, and Kosinas [FOCS 2024] for computing the -edge-connected components of a directed graph in linear time, which leverages the minset-poset technique of Gabow [TALG 2016].
Additionally, we provide a deterministic decremental algorithm for maintaining -edge-connectivity in strongly connected directed graphs. Given a sequence of edge deletions, our algorithm maintains the -edge-connected components in total time , while supporting the same queries as the incremental algorithm. This result assumes that the edges of a fixed spanning tree of and of its reverse graph are not deleted. Previously, the best known bound for the decremental problem was , obtained by a randomized algorithm without restrictions on the deletions.
In contrast to prior dynamic algorithms for -edge-connectivity in directed graphs, our method avoids the incremental computation of dominator trees, thereby circumventing the known conditional lower bound of .
Keywords and phrases:
Connectivity, dynamic algorithms, directed graphsCopyright and License:
2012 ACM Subject Classification:
Mathematics of computing Graph algorithms ; Theory of computation Graph algorithms analysisAcknowledgements:
We thank the anonymous reviewers for their helpful comments.Editors:
Anne Benoit, Haim Kaplan, Sebastian Wild, and Grzegorz HermanSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
The design of dynamic graph algorithms is a classical area of research in theoretical computer science, where the input graph evolves through a sequence of updates, typically edge insertions and deletions. The goal of a dynamic algorithm is to update the solution to a problem more efficiently than recomputing it from scratch after each change. A problem is said to be fully dynamic if both insertions and deletions are allowed, and partially dynamic if only one type of update is permitted. The latter includes the incremental setting (only insertions) and the decremental setting (only deletions).
A fundamental problem in this domain is the computation and maintenance of edge-connected components in both undirected and directed graphs, driven by various practical and theoretical applications (see, e.g., [30]). Let be a strongly connected directed graph (digraph) with vertices and edges. An edge is called a strong bridge if its removal disconnects the graph, i.e., is no longer strongly connected. More generally, a subset is a cut if its removal disconnects the graph. If , we refer to as a -sized cut of . A directed graph is said to be -edge-connected if it contains no -cuts. Two vertices and are -edge-connected, denoted , if there exist edge-disjoint directed paths from to and edge-disjoint directed paths from to . (Note that paths from to and from to need not be edge-disjoint with each other.) By Menger’s Theorem [27], this is equivalent to requiring that every set of fewer than edge deletions preserves strong connectivity between and . A -edge-connected component of is a maximal subset of vertices such that for all . These components form a partition of , since is an equivalence relation [14].
Connectivity problems are significantly more challenging in directed graphs than in undirected ones (see, e.g., [8, 18, 23]). Until recently, it was known how to compute the -edge-connected components of undirected graphs in linear time only for [7, 10, 12, 20, 25, 28, 29, 33, 38]. In a very recent breakthrough, Korhonen [24] presented an time algorithm for computing the -edge connected components of an undirected graph, which yields linear-time algorithms for any fixed . In contrast, for directed graphs, linear-time algorithms are only known for [13, 16, 33].
Despite significant progress in fully dynamic algorithms for several fundamental connectivity problems in undirected graphs (see, e.g., [19, 21, 22, 31, 37]), their directed counterparts remain substantially harder [4]. This difficulty is further underscored by conditional lower bounds [1, 17]. In particular, Abboud and Vassilevska [1] showed that any fully dynamic algorithm for maintaining whether a directed graph has more than two strongly connected components (SCCs) must incur update or query time (for any constant ) unless the Strong Exponential Time Hypothesis (SETH) fails. Due to such hardness results, much of the research has focused on partially dynamic scenarios. For the problem of dynamically maintaining the SCCs of a digraph, years of effort culminated in the following breakthrough results. For the decremental setting, Bernstein, Probst, and Wulff-Nilsen [4] developed a randomized algorithm (against an oblivious adaptive adversary) with total expected time, while very recently van den Brand et al. [39] gave a deterministic algorithm with total update time. For the incremental problem, also very recently, Chen et al. [6] gave a deterministic algorithm with total update time. We note that the algorithms of [6, 39] explicitly maintain the SCCs, while [4] only supports queries of whether two vertices are strongly connected.
In this paper, we revisit the dynamic maintenance of -edge-connected components in directed graphs, a problem first explored by Georgiadis, Italiano, and Parotsidis [15], who presented an incremental algorithm with total time and space . After each insertion, their algorithm supports the following queries in asymptotically optimal time:
-
: Test in time whether two vertices and are -edge-connected.
-
: Report all -edge-connected components in time.
Moreover, when the answer to a is negative, their algorithm returns in constant time a “witness”, i.e., a strong bridge that appears in all paths from to or in all paths from to .
The decremental version was studied in [11], where a randomized algorithm with total running time and space was presented.
Our results
We present new deterministic, incremental and decremental algorithms for maintaining the -edge-connected components of a directed graph that significantly improve upon the prior time bounds for graphs that are not very sparse.
Theorem 1.
We can maintain the -edge-connected components of a digraph with vertices through a sequence of edge insertions in total time. After each insertion, we can test in time whether two vertices are -edge-connected and report the components in time.
We also achieve nearly the same asymptotic bound in the decremental setting, under certain assumptions on the edges that may be deleted.
Theorem 2.
We can maintain the -edge-connected components of a strongly connected digraph with vertices through a sequence of edge deletions in total time, provided that the edges of a fixed spanning tree of and a fixed spanning tree of the reverse graph are not deleted. After each deletion, we can test in time whether two vertices are -edge-connected and report the components in time.
The bound stated in Theorem 2 assumes that we maintain SCCs decrementally using the algorithm of van den Brand et al. [39]. If instead we use the algorithm of Bernstein, Probst, and Wulff-Nilsen [4], we obtain a randomized -time algorithm that supports constant-time queries, but does not support .
Both our incremental and our decremental algorithms require space. Our results build on the recent framework of Georgiadis, Italiano, and Kosinas [13], which computes the -edge-connected components of a digraph in linear time using Gabow’s minset-poset technique [8] to represent all minimum edge-cuts of a digraph. From these results, it follows that the -edge-connected components of a digraph can be identified as the strongly connected components of two specially constructed labeling graphs. Although these labeling graphs can have size , we show how to maintain a compact representation of size that can be efficiently updated in the dynamic setting.
Our techniques are fundamentally different from those of [11, 15]. The algorithm of [15] relies on maintaining dominator trees incrementally, while [11] maintains the SCCs of for every vertex , using instances of a decremental SCCs algorithm [26]. This also supports decremental dominator tree maintenance in time and space. Importantly, [11] showed that maintaining dominator trees incrementally or decrementally in total time (for some constant ) is not possible unless the OMv Conjecture [17] fails. This bound applies even to algorithms that do not explicitly maintain the dominator tree but can answer parent queries. Consequently, both [11] and [15] are subject to this hardness barrier, whereas our new algorithms are not. However, unlike [15], our algorithms do not provide a witness edge when the answer to a is negative.
2 Preliminaries and notation
We assume that the reader is familiar with standard graph terminology. All graphs in this paper are directed, i.e., an edge in digraph is directed from , the tail of , to , the head of . Also, we allow to have multiple edges between the same pair of vertices. To simplify our bounds, we will assume that may have no more than two copies of each edge, so that the number of edges is . (Notice that adding more than two copies of the same edge does not affect -edge-connectivity.) If is a set of edges, then denotes the set of the reversed edges from . We also let denote the reverse graph of , i.e., the digraph that results from after reversing the orientation of all edges. For a graph or a set of edges , we use to denote the set of the endpoints of the edges in . If consists of a single edge , we may simply write (which denotes the set of the endpoints of ). Also, for a graph , we use to denote the set of edges in .
Let be a digraph. For any , we denote the set of edges whose tail is in and their head in by . We denote the set of outgoing edges from a set to the rest of the graph by , and the number of such edges by . Similarly, we denote the set of incoming edges from the rest of the graph to by and the number of such edges by . When contains only a single vertex , we slightly abuse notation and write instead of .
For a set of edges and a set of vertices , denotes the set of edges in that enter from .
2.1 Flow graphs, dominators, and bridges
A flow graph is a directed graph with a distinguished start vertex such that every vertex is reachable from . Let be a strongly connected graph. Since is strongly connected, all vertices are reachable from and reach , so we can view both and as flow graphs with start vertex . To avoid ambiguities, throughout the paper, we will denote those flow graphs respectively by and . Let be a flow graph with start vertex . An edge is a bridge of 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. A vertex is a dominator of a vertex ( dominates ) if every path from to in contains . The dominator relation is reflexive and transitive. Its transitive reduction is a rooted tree, the dominator tree : dominates if and only if is an ancestor of in . The dominator tree and the bridges of a flow graph can be computed in linear time [2, 5].
2.2 Cuts
A cut is a partition of the vertices of a graph into two disjoint subsets . A cut determines a cut-set , since the removal of these edges makes all vertices in unreachable from vertices in . We may use the term “cut” interchangeably to denote either the partition or the set of edges . (The meaning will always be clear from the context.) We say that a cut is a -sized cut if ; then we say is a -out set and is a -in set. A cut is trivial if or . A cut separates vertex from vertex if all paths from to contain an edge in . We refer to such a cut as an - cut. Any partition of the vertices into two sets and , such that and naturally defines an - cut. We also refer to the partition as an - cut of . The size of this cut is equal to , i.e., the number of edges directed from to . An - mincut is a cut of minimum size such that and . Consider a flow graph and a -in set such that . We call a -sized -cut of . Then, all paths from to contain an edge in . Clearly, any cut of is an -cut of or an -cut of , which allows us to focus only on the -cuts of .
2.3 Trees and fundamental cycles
Let be a rooted tree. Throughout, we assume that the edges of are directed away from the root. For each directed edge in , we say that is a parent of (and we denote it by ) and that is a child of . Every vertex except the root has a unique parent. If there is a (directed) path from vertex to vertex in , we say that is an ancestor of and that is a descendant of , and we denote this path by . If , we say that is a proper ancestor of and that is a proper descendant of , and denote by the path in to from the child of that is an ancestor of .
A spanning tree of a flow graph with start vertex is rooted at and contains a unique path from to any other vertex. For an edge , we let denote the fundamental cycle of in , i.e., the cycle that is formed in when we add edge , ignoring edge directions. Let , and let be the nearest common ancestor of and in . Then consists of two directed paths, one from to , and another from to . (One of these paths may consist of a single vertex.) For a set , we let denote the lowest common ancestor in of all vertices in .
Let be a flow graph and let be a spanning tree of rooted at . We let denote the set of non-tree edges of , i.e., . For any vertex , we let denote the set of non-tree edges that are incoming to .
2.4 Minimum -in sets
Let be a strongly connected digraph with a fixed start vertex . A set of vertices is called a -in set if and . For every vertex that is contained in a -in set, we let denote the (inclusion-wise) minimum -in set that contains . We call this the -set of . Note that is well-defined due to the submodularity of cuts. Specifically, we have the following.
Lemma 3.
Let and be two -in sets that contain a vertex . Then, is also a -in set.
Proof.
We have that and contain but not . By the submodularity of cuts, we have:
| (1) |
Since and are -in sets, the right hand side of (1) equals . Since and are cuts that separate from , we have and . Now (1) implies that . This shows that is a -in set.
If is not contained in a -in set, then we let . We use to denote the -set of in . The importance of considering the -sets (in both and ) is demonstrated in the following proposition.
Proposition 4 ([13]).
Let be a strongly connected digraph with a fixed start vertex . Then, for any two vertices and , we have if and only if and .
According to Proposition 4, in order to compute the -edge-connected components of , it is sufficient to compute the -sets in and . As in [13], our approach is to compute the partition of into the sets of vertices that have same -set in , and the sets of vertices that have the same -set in . It follows by Gabow [8], that this partition (w.r.t. either or ) corresponds to the strongly connected components of a labeling graph . So, our goal here is to show how to maintain this information efficiently in the incremental or decremental setting. Note that there are insertion sequences (or deletion sequences) that can cause changes of the -sets. See Figure 1.
First, we need to extend the definition of -sets to edges of as follows. Let be an edge such that there is a -in set that contains both endpoints of . Then denotes the edge-set of the induced subgraph of the minimum -in set that contains both endpoints of . To obtain the minimum -in set of each vertex , [8] uses an augmented version of , defined as follows. For every vertex of , we introduce a new vertex , two parallel edges of the form , and two parallel edges of the form . Let us call the resulting graph. Then, it follows that for every vertex of , we have that corresponds in a natural way to (in ).
Since, by Lemma 3, the sets are closed under intersection, they admit a poset representation. For any edge , let . We define the following relation on the edges of : for , let if and only if . Hence, forms a poset that represents all the minimum -sets.
3 Computing minimum -in sets via Gabow’s minset poset
Let be a strongly connected digraph, and let be an arbitrary vertex of . We view as a flow graph with start vertex . Recall that a -in set is a set of vertices such that and . Consider the flow graph , and let be a spanning tree rooted at . For simplicity, sometimes we slightly abuse notation and refer to as the set of tree edges. For any set of vertices , we denote by the subgraph of induced by . We say that is cut by if (that is, the only edges that enter are tree edges of ), and is cospanned by if is a tree. The next characterization follows from [8].
Lemma 5 ([8]).
Let be a flow graph with start vertex , and let be a spanning tree of . Any set of vertices is a -in set of if and only if it is cut and cospanned by .
According to Lemma 5, if is a -in set of , then is a tree with root and the only edge entering is the edge .
3.1 Labeling function and labeling graph
Gabow [8] defines a labeling graph with the property that the strongly connected components of correspond to the edges of that have the same -set. For any vertex , there is at most one incoming edge to that can be the incoming edge to , and the rest have the property that both of their endpoints also belong to . Thus, the idea is to assign a label to every edge , which is essentially a set of pointers to edges that participate in the same -set as . Thus, the -sets are given as the reachability sets of various edges with respect to this labeling. However, we cannot afford to explicitly compute the -sets of all vertices, as their total size can be quadratic to .
In [8], the vertex set of consists of the edges of , and the edges are defined by a labeling function . In our case, this labeling function becomes
| (2) |
This function implies a labeling graph that has vertex set (i.e., one vertex for each edge of ), and edges where and . For , we say that is a successor of if there is a path from to in . The important property of the labeling graph is that the minimum set of each edge is equal to the set of all successors of in [8]. This implies the following key proposition. (See Figure 2.)
Proposition 6 ([8, 13]).
Let be a strongly connected flow graph with start vertex , and let and be any two edges.
-
(a)
If is contained in a -in set, then if and only if and are strongly connected in .
-
(b)
If is not contained in a -in set, then and are strongly connected in if and only if is also not contained in a -in set.
By Proposition 6, we have that any two vertices and are -edge-connected if and only if and are strongly connected both in the labeling graph of and in the labeling graph of .
Note that each tree edge has out-degree equal to in , while each non-tree edge has out-degree equal to the number of tree edges in . Hence, has vertices and edges. Nevertheless, Gabow [8] showed that the nodes of the corresponding poset , which form a compact representation of these -sets sufficient for our purposes, can be computed in time by a clever implementation of an algorithm for computing the SCCs [7] of . (We remark that the node-finding algorithm of [8] does not compute the complete poset, which has vertices and edges.) The key idea is to use appropriate data structures, based on set merging [9], to avoid generating all edges of . This algorithm critically depends on a specific ordering of operations within the SCC algorithm, which makes it unsuitable for use in incremental or decremental settings.
4 Incremental algorithm
In this section, we present our incremental algorithm for maintaining the -edge-connected components of a digraph . We consider, first, the case where is strongly connected, and let be a spanning tree of the corresponding flowgraph , for an arbitrarily chosen start vertex . Our algorithm operates on a modified labeling graph, denoted by , with the following properties: (i) contains vertices and edges, (ii) the SCCs of correspond to the poset nodes of the minimum -in sets of , where , and (iii) we can efficiently maintain through a sequence of edge insertions.
4.1 Modified labeling graph
The modified labeling graph is defined as follows. The vertex set of consists of the tree edges of and the vertices of , i.e., . The edge set is defined by the following modified labeling function :
| (3) |
Hence, if and only if . Note that both and are bipartite graphs, since any edge connects a tree edge with a non-tree edge in the former, and a tree edge with a vertex in the latter. While has vertices and edges, has vertices and edges.
Lemma 7.
For any two edges , is reachable from in if and only if is reachable from in .
Proof.
Suppose is reachable from in . Let be a path from to in . Since is bipartite, the length of is even. Consider two consecutive edges and on , such that and . Also, let . Then, by the definition of , , and . Then, by the definition of , contains and , and either or . In both cases, reaches in . Hence, it follows by induction on the length of that if is reachable from in then is also reachable from in .
We show the contrapositive by similar arguments. Suppose is reachable from in . Let be a path from to in . Since is bipartite, the length of is even. Consider two consecutive edges and on , such that and . Also, let . Then, by the definition of , , where . Then, by the definition of , contains the edges and , and so reaches in . Hence, it follows by induction on the length of that if is reachable from in then is also reachable from in .
An alternative but equivalent definition of can be obtained by applying a sequence of vertex contractions to . Specifically, for each vertex , we contract all non-tree edges in and subsequently eliminate any duplicate edges. While this may appear more intuitive, we adopt the original formulation as it enables the construction of in total time.
Corollary 8.
For any two edges , if and only if and are strongly connected in .
By Proposition 4 and Corollary 8, to determine whether two vertices and are -edge-connected in , it suffices to check whether the edges and in the augmented graph are strongly connected in both the modified labeling graph of and that of its reverse . The following lemma shows that, in fact, it is not necessary to work with the augmented graph explicitly.
Lemma 9.
For any two vertices , is reachable from in the modified labeling graph of if and only if is reachable from in .
Proof.
Suppose contains a path from to . Since is bipartite, and because the only non-tree edges entering in , except its copy , are in , the next vertex on after must be . Consider now the penultimate vertex on . Then , and from the definition of (equation (3)), there is a non-tree edge such that . But this is possible only for and . Hence, contains a path from to , and so, also contains a path from to .
Now suppose that contains a path from to . From the definition of (equation (3)), contains an edge from to . Also, since and , also contains an edge from to . Hence, contains a path from to .
Corollary 10.
Let be a strongly connected digraph with a fixed start vertex . Then, for any two vertices and , we have if and only if and are strongly connected in the modified labeling graph of and in the modified labeling graph of .
4.2 Incremental construction of
Here we describe how to construct incrementally as edges are added to a strongly connected graph with a designated start vertex . The labeling graph is defined with respect to a fixed spanning tree of the flow graph , rooted at . (Similarly, we have a fixed spanning tree of , rooted at , that defines the labeling graph of .)
We initialize by inserting a vertex for each and for each tree edge . Also, for each tree edge , we add to the edges and .
Let be a vertex of , and let be a tree edge of . We say that is covered by if there is an edge such that , i.e., if . For each vertex , we maintain the set of tree edges that are covered by , using the following simple fact.
Lemma 11.
Let be a vertex such that , and let be the set of tree edges that are covered by . Then, is a tree, rooted at the lowest common ancestor in of all the vertices in .
Proof.
Consider an edge . Then, is contained in the fundamental cycle , so is connected. Since , is a tree. Let be the root of . If contains a single edge , then is rooted at . Now suppose . Let and be two edges in . Let and . Since both and are ancestors of in , we have . We conclude that .
Lemma 11 allows us to use simple data structures to maintain for each vertex . Specifically, we do not maintain explicitly, but keep a bit vector , indexed by the vertices of that indicates the vertices participating in . Also, we store the current root of . During the construction we maintain the following invariant (I): For any vertex , we have if and only if is covered by . Thus, if and only if , which means that contains the edge . So, intuitively, we can view the bit vectors as forming an adjacency matrix of the vertices in .
Initially, we set , for all vertices , and set . (The root of is the only vertex in that is not marked in .) Furthermore, we need to be able to test the ancestor-descendant relation in . There are several simple -time tests of this relation [34]. The most convenient one for us is to number the vertices of from to in preorder and compute the number of descendants of each vertex . We denote these numbers by and , respectively. Then is a descendant of if and only if .
Suppose now that an edge is added into . Then, since is a spanning tree of , is a new non-tree edge in . So, we need to find the tree edges such that does not contain the edge . Equivalently, we need to find the vertices in that are not already marked in . Let be the lowest common ancestor of and in . (Note that we only use for reference and do not need to find it explicitly.) To find the relevant unmarked vertices, we traverse the part of the cycle from to as follows. Let be the current vertex. While is not an ancestor of , we check if . If not, then we set , add the edge from to in , and set . Otherwise, we let . This procedure stops as soon as is an ancestor of . At this point, if , then we set . We repeat the same procedure for , where we stop when becomes an ancestor of .
Lemma 12.
The above procedure correctly updates in total time for all edge insertions.
Proof.
It is easy to verify that the procedure maintains invariant (I) correctly, because of Lemma 11. Also, the algorithm inserts an edge into if and only if is covered by , which is in accordance to the labeling function . Now we bound the total running time for the construction of after all insertions. The total running time is dominated by the time we need to locate tree edges that are just covered by each insertion. Let be a newly added edge to . The above procedure visits at most two vertices that are already marked in . For all other visited vertices , we have before the visit and after the visit, excluding , which also is visited at most twice per added edge. Hence, the total time throughout the whole sequence of insertions is bounded by .
4.3 Incremental computation of the -edge-connected components
Let be a strongly connected graph that undergoes edge insertions. We chose an arbitrary start vertex , and compute a spanning trees of and a spanning of , rooted at . We maintain two instances of the modified labeling graph of Section 4.1, that represents the minimum -in sets of , and that represents the minimum -in sets of , using the two fixed spanning trees and . When an edge is inserted into , we execute the update operation of Section 4.2 for and for . Note that for , we search for tree edges of that are covered by .
We maintain the SCCs of and incrementally, by running on each labeling graph the incremental SCCs algorithm of Bender et al. [3] for dense graphs. For a digraph with vertices, the algorithm of [3] runs in total time. The modified labeling graphs and have vertices and edges, since during their construction we never add duplicate edges. By Lemma 12, we can construct them incrementally in time, and the total time for maintaining their SCCs is also .
We turn now to the query operations and . Each SCC of (and similarly of ) is represented by a canonical vertex, and the partition of the vertices into SCCs is maintained through a disjoint set union data (DSU) structure [36, 35]. The DSU data structure supports the operation , which, given canonical vertices and , merges the SCCs containing and into one new SCC and makes the canonical vertex of the new SCC. It also supports the query , which returns the canonical vertex of the SCC containing . Since we aim at constant time queries, we use such a data structure that can support each operation in worst-case time and any sequence of operations in total time [36]. This way, we can identify the canonical vertex of the auxiliary component containing a query vertex in constant time. Hence, by Corollary 10, we can answer in also in constant time, by testing if and are strongly connected in both and .
To answer a query, we create, for each vertex , a label , where and are the canonical vertices in the SCCs of and , respectively, that contain . As above, each of these canonical vertices is available in time. We form a list consisting of for all , and sort them lexicographically in time using bucket sorting. Then, in the sorted list , the vertices of the same -edge-connected component appear consecutively, since they have the same canonical vertices in their labels. Therefore, we can report the -edge-connected components of in time.
4.4 Extension to general digraphs
Now we extend our incremental algorithm to general (not strongly connected) digraphs. We note that Proposition 6 requires us to use labeling graphs that correspond to strongly connected flow graphs. To that end, we construct a two-level data structure, that uses various instances of the incremental SCCs algorithm of Bender et al. [3], as mentioned in Section 4.3.
Let be the input digraph subject to edge insertions. The top level of our data structure, that we refer to as , maintains the strongly connected components of with the use of the incremental SCCs algorithm of [3]. More precisely, maintains the SCCs of , represented with a DSU data structure, and the condensation of , denoted by , which is the directed acyclic graph that results from after we contract each SCC into its canonical vertex. We note that [3] also maintains a topological ordering of , and when a new SCC is formed, it removes loops and duplicate edges. The bottom level of our data structure maintains the information about the -in sets and -out sets within each SCC of , in a structure . Specifically, for each strongly connected component of , with a designated start vertex , we store a spanning tree of and a spanning tree of , rooted at . Also, we maintain the data structures of Sections 4.2 and 4.3.
Now we describe how to handle an edge insertion. Suppose a new edge is inserted into . If and are located the same SCC of , then we execute the insertion procedure for , described in Sections 4.2 and 4.3. Otherwise, we execute the insertion in the data structure. Note that this operation inserts the edge into the condensation of . If this insertion does not create a cycle in then we are done. Otherwise, finds a new SCC of , corresponding to a new SCC of , that is contracted into some canonical vertex. As a result, we need to update the bottom-level structure for the involved components of .
Let be the new SCC of . The data structure identifies all components of that are merged into after the insertion of , along with the edges that connect distinct components. (Each such edge satisfies , , where precedes in a topological ordering of the components.) Without loss of generality, assume that is the largest of these components. We choose the canonical (start) vertex of to be the start vertex of . We refer to this component as the principal component of . Also, we refer to the vertices of as the principal vertices of . The remaining vertices in are the secondary vertices of .
Now we describe how to construct the data structure for the new component . We describe only the construction of the structures for . The structures for the reverse graph are updated similarly. First, we extend the spanning tree of , which is rooted at , to a spanning tree of rooted at , so that . To achieve this, it suffices to traverse the edges and the edges of the two spanning trees that we maintain for each component . This is enough to construct , since the two spanning trees of each form a sparse strongly connected subgraph of . (Note that we cannot afford to traverse all edges of .) Once is constructed, we traverse it to recompute and for all . This enables testing the ancestor-descendant relation in in time.
Next, we need to update the structures that keep track of the covered edges of for each vertex . To initialize these structures for the new component , we maintain the structures and , for all principal vertices as they are. Then, we insert the nontree edges such that is a secondary vertex in . For each secondary vertex , we compute and from scratch. Hence, in effect we construct by inserting the secondary vertices and their adjacent edges in the data structure of the principal component.
Lemma 13.
The above procedure correctly updates , for all SCCs of in total time over all edge insertions.
Proof.
The correctness of the algorithm follows from Lemma 12, and the fact that the top structure maintains the SCCs of . Next, we bound the total running time for any sequence of edge insertions.
First, we bound the total running time required to update the spanning tree of , for each SCC formed in . Let be a new SCC of that is formed by merging the components , where is the principal component. Let be the number of vertices in each component , and let be the number of edges connecting and . Then, the construction of takes time proportional to , where is the number of vertices in the new component . Note that the second term, i.e., the sum is charged only once during the construction of all spanning trees. Hence, the overall construction time for all spanning trees is .
Next, we consider the time required to maintain the data structures for the tree edges covered by each vertex . Note that for as long as is a principal vertex in a component , the total time spent to process the edges in and update and is . Next, we consider the contribution of each vertex as a secondary vertex. Every time we merge a sequence of secondary components with a principal component , we charge time to each secondary vertex , since we recompute and from scratch. Let be the sequence of SCCs that contain as a secondary vertex. Let be the number of vertices in just before it gets merged into a larger component. Then, , for , and . The time required to maintain the data structures for the tree edges covered by in is proportional to . Hence, the total time for the whole sequence of components is bounded by . This gives an total bound for all vertices.
Finally, we consider the total time required to maintain the incremental SCCs data structures. Such a structure for the subgraph induced by a component with vertices requires total time. We distribute this cost to the vertices of the component, so each vertex is charged a cost of . Hence, for as long as a vertex is a principal vertex in its component , it is charged a cost of , where is the number of vertices in just before it is merged as a secondary component. If this never happens, then is the final number of vertices in . It remains to bound the contribution of as a secondary vertex, which we can do as above. Let be the sequence of SCCs that contain as a secondary vertex, where each has vertices just before it gets merged into a larger component. As before, , for , and . Then, the cost charged to for the whole sequence of components is bounded by . This gives an total bound for all vertices.
5 Decremental algorithm
In this section, we present our decremental algorithm for maintaining the -edge-connected components of a digraph . We can assume that is strongly connected, as otherwise we can process each SCC separately. Let be an arbitrarily chosen start vertex of . Let be a fixed spanning tree of flow graph , and let be a fixed spanning tree of flow graph . (Both and are rooted at .) The algorithm operates on the assumption that the edges of and are never deleted throughout the deletion sequence.
We describe how to efficiently update the edges of the modified labeling graph of Section 4.1, as we delete edges in . To achieve this, we need to maintain some additional information about the tree edges that are covered by each vertex .
For a tree edge , we define to be the number of edges that cover , i.e., such that . Then if and only if . Our approach is to maintain the values using a dynamic tree data structure [32]. This way, we can update efficiently, and maintain its SCCs decrementally using the algorithm of [39].
A dynamic tree is a data structure that efficiently maintains a collection of rooted trees, whose edges have real-valued costs, under dynamic operations such as linking and cutting edges, while supporting cost updates and queries on paths and subtrees. For our purposes, we will assume that each such data structure maintains a single tree that corresponds to the spanning tree of with root . Recall that for any vertex , denotes the parent of in . Here, we also let denote the tree path between two vertices and , ignoring edge directions.
We will use the following dynamic tree operations, which are supported in time.
-
: If , then return the cost of the edge .
-
: Add to the cost of all edges on the tree path .
-
: Return a vertex such that the edge has minimum cost among the edges on the tree path .
We note that the original description of Sleator and Tarjan [32] has the operation , which adds the value to the cost of the edges on the path from to the root of , and the operation , which returns an edge of minimum cost on the path from to the root of . We can implement our versions of and , by using the operation of [32], which makes the root of , as follows. To implement , we do , , and . Similarly, to implement we do , , and .
To initialize , we compute a spanning tree of rooted at , and insert the edges of as in Section 4.2. We also compute the and values for all , so that we can test the ancestor-descendant relation in in time. Then, for each vertex , we maintain a dynamic tree data structure , which implements the operations and on , where each tree edge has cost . Initially, all edge costs in are zero. Then, we process each edge , and execute .
During the execution of the deletion sequence, we do the following. Let be the next edge of to be deleted. By our assumption, , and we need to find the tree edges that are covered only by . For each such tree edge , we delete the corresponding edge from .
To find these edges , first we execute . Then, we recursively search a tree path for uncovered edges (that is, tree edges with ), where initially and , as follows. We compute , and check if . If this is the case, then all the edges on are still covered by , and we are done. Otherwise, we delete the edge from , and repeat recursively this step for the two paths of .
In more detail, if is an ancestor of , then we recursively search for uncovered edges on and on . Otherwise, if is an ancestor of , then we recursively search for uncovered edges on and on . Hence, we obtain the following bound.
Lemma 14.
We can maintain the modified label graph under a sequence of edge deletions of in total time.
Proof.
Consider the deletion of an edge . The above procedure finds a tree edge that becomes uncovered by using a constant number of dynamic tree operations. For each edge with , we delete the corresponding edge in . Since has edges, and each dynamic tree operation takes time, the bound follows.
References
- [1] Amir Abboud and Virginia Vassilevska Williams. Popular conjectures imply strong lower bounds for dynamic problems. In FOCS, pages 434–443, 2014. doi:10.1109/FOCS.2014.53.
- [2] Stephen Alstrup, Dov Harel, Peter W. Lauridsen, and Mikkel Thorup. Dominators in linear time. SIAM Journal on Computing, 28(6):2117–32, 1999. doi:10.1137/S0097539797317263.
- [3] Michael A. Bender, Jeremy T. Fineman, Seth Gilbert, and Robert E. Tarjan. A new approach to incremental cycle detection and related problems. ACM Trans. Algorithms, 12(2), December 2015. doi:10.1145/2756553.
- [4] Aaron Bernstein, Maximilian Probst, and Christian Wulff-Nilsen. Decremental strongly-connected components and single-source reachability in near-linear time. In Proceedings of the 51st Annual ACM SIGACT Symposium on Theory of Computing, STOC 2019, pages 365–376, New York, NY, USA, 2019. Association for Computing Machinery. doi:10.1145/3313276.3316335.
- [5] Adam L. Buchsbaum, Loukas Georgiadis, Haim Kaplan, Anne Rogers, Robert E. Tarjan, and Jeffery R. Westbrook. Linear-time algorithms for dominators and other path-evaluation problems. SIAM Journal on Computing, 38(4):1533–1573, 2008. doi:10.1137/070693217.
- [6] Li Chen, Rasmus Kyng, Yang P. Liu, Simon Meierhans, and Maximilian Probst Gutenberg. Almost-linear time algorithms for incremental graphs: Cycle detection, sccs, s-t shortest path, and minimum-cost flow. In Proceedings of the 56th Annual ACM Symposium on Theory of Computing, STOC 2024, pages 1165–1173, New York, NY, USA, 2024. Association for Computing Machinery. doi:10.1145/3618260.3649745.
- [7] Harold N. Gabow. Path-based depth-first search for strong and biconnected components. Information Processing Letters, 74:107–114, 2000. doi:10.1016/S0020-0190(00)00051-X.
- [8] Harold N. Gabow. The minset-poset approach to representations of graph connectivity. ACM Transactions on Algorithms, 12(2):24:1–24:73, February 2016. doi:10.1145/2764909.
- [9] Harold N. Gabow and Robert E. Tarjan. A linear-time algorithm for a special case of disjoint set union. Journal of Computer and System Sciences, 30(2):209–21, 1985. doi:10.1016/0022-0000(85)90014-5.
- [10] Zvi Galil and Giuseppe F. Italiano. Reducing edge connectivity to vertex connectivity. SIGACT News, 22(1):57–61, March 1991. doi:10.1145/122413.122416.
- [11] Loukas Georgiadis, Thomas Dueholm Hansen, Giuseppe F. Italiano, Sebastian Krinninger, and Nikos Parotsidis. Decremental data structures for connectivity and dominators in directed graphs. In ICALP, pages 42:1–42:15, 2017. doi:10.4230/LIPIcs.ICALP.2017.42.
- [12] Loukas Georgiadis, Giuseppe F. Italiano, and Evangelos Kosinas. Computing the 4-edge-connected components of a graph in linear time. In Proc. 29th European Symposium on Algorithms, pages 47:1–47:17, 2021. doi:10.4230/LIPIcs.ESA.2021.47.
- [13] Loukas Georgiadis, Giuseppe F. Italiano, and Evangelos Kosinas. Computing the 3-edge-connected components of directed graphs in linear time. In 65th IEEE Annual Symposium on Foundations of Computer Science, FOCS 2024, pages 62–85, 2024. doi:10.1109/FOCS61266.2024.00015.
- [14] Loukas Georgiadis, Giuseppe F. Italiano, Luigi Laura, and Nikos Parotsidis. 2-edge connectivity in directed graphs. ACM Transactions on Algorithms, 13(1):9:1–9:24, 2016. doi:10.1145/2968448.
- [15] Loukas Georgiadis, Giuseppe F. Italiano, and Nikos Parotsidis. Incremental 2-edge-connectivity in directed graphs. In ICALP, pages 49:1–49:15, 2016. doi:10.4230/LIPIcs.ICALP.2016.49.
- [16] Loukas Georgiadis, Giuseppe F. Italiano, and Nikos Parotsidis. Strong connectivity in directed graphs under failures, with applications. SIAM J. Comput., 49(5):865–926, 2020. doi:10.1137/19M1258530.
- [17] Monika Henzinger, Sebastian Krinninger, Danupon Nanongkai, and Thatchaphol Saranurak. Unifying and strengthening hardness for dynamic problems via the online matrix-vector multiplication conjecture. In STOC, pages 21–30, 2015. doi:10.1145/2746539.2746609.
- [18] Monika Henzinger, Satish Rao, and Di Wang. Local flow partitioning for faster edge connectivity. SIAM Journal on Computing, 49(1):1–36, 2020. doi:10.1137/18M1180335.
- [19] Jacob Holm, Kristian de Lichtenberg, and Mikkel Thorup. Poly-logarithmic deterministic fully-dynamic algorithms for connectivity, minimum spanning tree, 2-edge, and biconnectivity. J. ACM, 48(4):723–760, July 2001. doi:10.1145/502090.502095.
- [20] John E. Hopcroft and Robert E. Tarjan. Dividing a graph into triconnected components. SIAM Journal on Computing, 2(3):135–158, 1973. doi:10.1137/0202012.
- [21] Shang-En Huang, Dawei Huang, Tsvi Kopelowitz, and Seth Pettie. Fully dynamic connectivity in amortized expected time. In Proceedings of the Twenty-Eighth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA ’17, pages 510–520, USA, 2017. Society for Industrial and Applied Mathematics. doi:10.5555/3039686.3039718.
- [22] Wenyu Jin and Xiaorui Sun. Fully dynamic s-t edge connectivity in subpolynomial time (extended abstract). In 2021 IEEE 62nd Annual Symposium on Foundations of Computer Science (FOCS), pages 861–872, 2022. doi:10.1109/FOCS52979.2021.00088.
- [23] Ken-Ichi Kawarabayashi and Mikkel Thorup. Deterministic edge connectivity in near-linear time. Journal of the ACM, 66(1), December 2018. doi:10.1145/3274663.
- [24] Tuukka Korhonen. Linear-time algorithms for k-edge-connected components, k-lean tree decompositions, and more. In Proceedings of the 57th Annual ACM Symposium on Theory of Computing, STOC ’25, pages 111–119, New York, NY, USA, 2025. Association for Computing Machinery. doi:10.1145/3717823.3718123.
- [25] Evangelos Kosinas. Computing the 5-edge-connected components in linear time. In Proceedings of the Annual ACM-SIAM Symposium on Discrete Algorithms, pages 1887–2119, 2024. doi:10.1137/1.9781611977912.76.
- [26] Jakub Łącki. Improved deterministic algorithms for decremental reachability and strongly connected components. ACM Transactions on Algorithms, 9(3):27, 2013. doi:10.1145/2483699.2483707.
- [27] Karl Menger. Zur allgemeinen kurventheorie. Fundamenta Mathematicae, 10(1):96–115, 1927.
- [28] Wojciech Nadara, Mateusz Radecki, Marcin Smulewicz, and Marek Sokołowski. Determining 4-edge-connected components in linear time. In Proc. 29th European Symposium on Algorithms, pages 71:1–71:15, 2021. doi:10.4230/LIPIcs.ESA.2021.71.
- [29] Hiroshi Nagamochi and Toshihide Ibaraki. A linear time algorithm for computing 3-edge-connected components in a multigraph. Japan J. Indust. Appl. Math, 9(163), 1992. doi:10.1007/BF03167564.
- [30] Hiroshi Nagamochi and Toshihide Ibaraki. Algorithmic Aspects of Graph Connectivity. Cambridge University Press, 2008. 1st edition. doi:10.1017/CBO9780511721649.
- [31] Danupon Nanongkai, Thatchaphol Saranurak, and Christian Wulff-Nilsen. Dynamic Minimum Spanning Forest with Subpolynomial Worst-Case Update Time . In 2017 IEEE 58th Annual Symposium on Foundations of Computer Science (FOCS), pages 950–961, Los Alamitos, CA, USA, October 2017. IEEE Computer Society. doi:10.1109/FOCS.2017.92.
- [32] Daniel D. Sleator and Robert E. Tarjan. A data structure for dynamic trees. Journal of Computer and System Sciences, 26:362–391, 1983. doi:10.1016/0022-0000(83)90006-5.
- [33] Robert E. Tarjan. Depth-first search and linear graph algorithms. SIAM Journal on Computing, 1(2):146–160, 1972. doi:10.1137/0201010.
- [34] Robert E. Tarjan. Finding dominators in directed graphs. SIAM Journal on Computing, 3(1):62–89, 1974. doi:10.1137/0203006.
- [35] Robert E. Tarjan. Efficiency of a good but not linear set union algorithm. Journal of the ACM, 22(2):215–225, 1975. doi:10.1145/321879.321884.
- [36] Robert E. Tarjan and Jan van Leeuwen. Worst-case analysis of set union algorithms. Journal of the ACM, 31(2):245–81, 1984. doi:10.1145/62.2160.
- [37] Mikkel Thorup. Fully-dynamic min-cut. Combinatorica, 27(1):91–127, February 2007. doi:10.1007/s00493-007-0045-2.
- [38] Yung H. Tsin. Yet another optimal algorithm for 3-edge-connectivity. Journal of Discrete Algorithms, 7(1):130–146, 2009. Selected papers from the 1st International Workshop on Similarity Search and Applications (SISAP). doi:10.1016/j.jda.2008.04.003.
- [39] Jan van den Brand, Li Chen, Rasmus Kyng, Yang P. Liu, Simon Meierhans, Maximilian Probst Gutenberg, and Sushant Sachdeva. Almost-Linear Time Algorithms for Decremental Graphs: Min-Cost Flow and More via Duality . In 2024 IEEE 65th Annual Symposium on Foundations of Computer Science (FOCS), pages 2010–2032, Los Alamitos, CA, USA, October 2024. IEEE Computer Society. doi:10.1109/FOCS61266.2024.00120.
