2016 IEEE 57th Annual Symposium on Foundations of Computer Science

Decremental Single-Source Reachability and Strongly Connected Components in  √ O(m n) Total Update Time

Shiri Chechik∗, Thomas Dueholm Hansen†, Giuseppe F. Italiano‡, Jakub Ł ˛acki§, Nikos Parotsidis¶ ∗Tel Aviv University, Tel Aviv, Israel. Email: [email protected] †Aarhus University, Aarhus, Denmark. Email: [email protected] ‡University of Rome Tor Vergata, Rome, Italy. Email: [email protected] §Sapienza University of Rome, Rome, Italy. Email: [email protected] ¶University of Rome Tor Vergata, Rome, Italy. Email: [email protected]

Abstract—We present√ randomized algorithms with a total goal is to maintain the set of nodes that are reachable from update time of O˜(m n) for the problems of decremental single- s, subject to edge deletions. source reachability and decremental strongly connected compo- In this paper we present an improved randomized decre- nents on directed graphs. This improves recent breakthrough results of Henzinger, Krinninger and Nanongkai [STOC 14, mental single-source reachability√ algorithm with an improved ICALP 15]. In addition, our algorithms are arguably simpler. running time of O(m n log n). In addition, our algorithm is arguably simpler. Keywords-dynamic algorithm; single-source reachability; Previous Results: A naive approach to decremental strongly connected components single-source reachability (SSR) is to simply recompute from scratch all the vertices that are reachable from the source after every deletion. This can be done in O(m + n) I. INTRODUCTION time per update, and gives a total update time of O(m2) Dynamic graph algorithms are designed to answer queries over all deletions. Even and Shiloach [9] were the first to on graphs subject to updates, such as adding or removing a beat this naive approach, with a decremental algorithm that vertex or an edge. Typically, one is interested in a very small runs in O(mn) total update time. (A similar scheme was query time (either constant or poly-log), while minimizing the independently found by Dinitz [10].) Although the algorithm update time as much as possible. A dynamic algorithm is said of Even and Shiloach solves a more general problem than to be incremental if it handles only insertions, decremental decremental single-source reachability, it was still the best if it handles only deletions, and fully dynamic if it handles known for the problem and the O(mn) barrier stood for both insertions and deletions. Dynamic graph algorithms have more than three decades. Only in the special case of directed been extensively studied in the last four decades, and efficient acyclic graphs, decremental SSR could be solved faster, i.e, dynamic algorithms with poly-log update times are known in O(m) total update time [11]. for many basic problems on undirected graphs, including A closely related problem is the decremental maintenance dynamic connectivity, dynamic 2-edge connectivity, dynamic of strongly connected components (SCC), where we are 2-vertex connectivity, and dynamic minimum spanning required answer queries of the form: “Given two vertices u (see, e.g., [1]–[6]). and v,dou and v belong to the same SCC?”. This problem is Dealing with directed graphs seems much more chal- almost equivalent to the decremental SSR problem: A solution lenging. In fact, up until very recently, even for very for decremental SCC trivially implies a decremental SSR basic reachability problems (e.g., decrementally maintaining algorithm with the same running time, while a decremental whether a fixed node s can reach a fixed node t), no sublinear SSR algorithm with running time O(mnβ), with β =Ω(1), (in the number of vertices) update time algorithms were implies a decremental SCC algorithm with essentially the known for general graphs. Very recently, in an important same expected total update time (see [7], [12]). This justifies breakthrough, Henzinger, Krinninger and Nanongkai [7], why for many years the best known upper bound for a managed to circumvent this barrier, by presenting a ran- decremental SCC algorithm was also O(mn) [12]–[14]. The domized decremental single-source reachability algorithm lack of improvement made researchers in the field wonder with total update time O(mn0.984+o(1)) (that is with n1− whether O(mn1−) was possible [12], [13], [15]. In a recent amortized update time for some fixed ). They later improved breakthrough, Henzinger, Krinninger and Nanongkai [7] the running time to O(mn0.9+o(1)) [8]. Both these algorithms showed that this is indeed possible and presented algorithms are quite involved and solve the more general problem of for decremental SCC and SSR with O(mn0.984+o(1)) total single-source decremental reachability. In this problem we update time. They later [8] improved this to O(mn0.9+o(1)). are given a G and a source node s and the Both these results are Las Vegas randomized.

0272-5428/16 $31.00 © 2016 IEEE 314315 DOI 10.1109/FOCS.2016.42 Our Results: We present improved randomized decre- (resp., an edge uv) from G. Additionally, we let G[S] be the mental SSR√ and SCC algorithms with total update time subgraph of G induced by the set of vertices S. Let H be of O(m n log n). This matches the best known result for a strongly connected graph. We say that deleting an edge planar graphs [13], up to logarithmic factors. In addition to the uv breaks H,ifH \ uv is not strongly connected. Let u, v substantially improved bounds, our algorithms are arguably be two vertices of G. We denote by dist(u, v) the distance simpler than the algorithms in [7], [8]. Our single-source from u to v. If there is no path from u to v, dist(u, v)=∞. reachability algorithm can be generalized to an algorithm for The diameter of G is the largest distance in G.IfG is not maintaining reachability from k fixed vertices, at the cost strongly connected, its diameter is equal to ∞. of increasing the running time by an additive O(km log n) For a given initial graph G, the decremental SCC problem term. (Due to lack of space, the details are deferred to the asks us to maintain a data structure that allows edge deletions full version of the paper.) We focus our attention on giving and that can answer whether (arbitrary) pairs of vertices are a faster decremental SCC algorithm, as a decremental SSR in the same SCC. The goal is to update the data structure as algorithm follows from it quite easily. Our decremental SCC quickly as possible while still answering queries in constant algorithm uses two existing decremental SCC algorithms. time. The decremental single-source reachability (SSR) One is the O(mn) total expected time algorithm by Roditty problem similarly asks us to maintain a data structure that and Zwick [12] and the other is the O(mn) total worst-case allows edge deletions and that can answer whether (arbitrary) time algorithm by Łacki ˛ [13]. What is crucial for our result, vertices are reachable from a fixed given source v ∈ V (G). is that in some special cases the running time bounds of both Our algorithm for maintaining SCCs under edge deletions is these algorithms can be improved. The algorithm by Roditty obtained by combining two previous data structures: Even- and Zwick uses Even-Shiloach trees (in short ES-trees) to Shiloach trees [9] and Ł ˛acki’s SCC-decomposition [13]. We maintain BFS trees under edge deletions. This data structure next briefly describe these two data structures. requires O(mn) total time in the general case, but only O(mδ) time, if the diameter of the graph does not exceed A. ES-tree δ. On the other hand, the performance of Ł ˛acki’s algorithm can be improved if the graph contains a small separator, i.e. Even and Shiloach [9] introduced a data structure, com- a small set of vertices, whose removal considerably reduces monly referred to as an Even-Shiloach tree (ES-tree), to the sizes of the SCCs. maintain a breadth-first search (BFS) tree from a given source We show that each graph has one of the two afore- vertex under edge deletions. Let G be a graph and r ∈ V (G). mentioned properties. Namely, we prove that in a graph Clearly, G is strongly connected iff the BFS trees from r in of diameter Ω(q log n) there exists a set of k vertices (a G and G both contain all vertices of G. Checking whether separator), whose removal results in the largest SCC having G remains strongly connected when edges are deleted can size at most n − kq. This allows us to combine the algorithm therefore be done by maintaining two ES-trees F and F  for of Roditty and Zwick with the algorithm by Ł ˛acki.We use G and G, respectively. Our algorithm uses such a pair of ES- the former as long as the graph has small diameter (as it uses trees from a shared source r to detect when an edge deletion ES-trees internally it can also measure the diameter up to a breaks a strongly connected subgraph. An ES-tree can also constant factor), and√ once the diameter exceeds a predefined be modified such that it maintains a set of vertices, whose threshold δ =Θ( n), we switch to the algorithm by Ł ˛acki. distance from the root is at most δ, where δ is a parameter At this point the graph has a separator of small size, which specified when the ES-tree is built. The data structure may we can use to make the algorithm by Ł ˛ackirun efficiently. report all vertices whose distance from the root is more We believe that our structural result regarding separators may than δ (which includes vertices not reachable from the root). be of independent interest. Maintaining such an ES-tree takes O(mδ) total time. Let G be a graph, r ∈ V (G), and δ>0. Our algorithm uses a data II. PRELIMINARIES structure that maintains two independent δ-depth-bounded Let G =(V,E) be a directed graph with vertex set V = ES-trees. Both trees are rooted in r and have depth bound δ. V (G) and edge set E = E(G). We denote the number of One of them is built in G and the other one in G. We call vertices and edges by n and m, respectively. G is strongly such a data structure an in-out ES-tree. connected if every vertex is reachable from every other vertex. G r ∈ V G The strongly connected components (in short SCCs) of G Definition 1 (In-out ES-tree). Let be a graph, ( ), δ> δ G are its maximal strongly connected subgraphs. The SCCs of and 0.A -depth-bounded in-out ES-tree of is a data E G, r, δ, D D a graph can be computed in O(m + n) time [16]. We let G structure =( ) that maintains the set of all v ∈ V G r, v >δ v, r > be the graph obtained by reversing the direction of all edges vertices ( ) with either dist( ) or dist( ) δ in G, and refer to G as the reversed graph of G. Note that , and that supports the following four operations:  G and G have the same SCCs. We denote by G \ S (resp., • Delete an edge uv from G, and update D accordingly. G \ uv) the graph obtained after deleting a set S of vertices • List all vertices of D.

315316 • List all vertices C ⊆ D that are unreachable from or node φ of T we define Gφ to be the subgraph of G induced cannot reach r in G. by the union of all descendants of φ (including φ). Then, the • Delete a vertex v ∈ D from both D and G (together following hold: with its incident edges). • Each internal node φ of T is a single-element set.1 • Let φ be any internal node of T , and let H ,...,Ht Note that D includes all vertices that are unreachable 1 be the SCCs of Gφ \ φ. Then the node φ has t from or cannot reach r. In our algorithm we only access children φ ,...,φt, where Gφ G φi Hi for all the in-out ES-trees by running the two query operations 1 i = [ ]= i ∈{1,...,t}. given in Definition 1. We let BUILD-ES-TREE(G, r, δ) be G a function that builds an in-out ES-tree E =(G, r, δ, D) for An SCC-decomposition of a graph that is not strongly G. We say that the depth invariant of E is violated if the connected is a collection of SCC-decompositions of the SCCs G T set D is nonempty. Observe that if the depth invariant is of . We say that is a partial SCC-decomposition when T not violated, then the graph G represented by E is strongly the leaves of are not required to be singletons. connected. The following lemma follows straightforwardly Observe that for each node φ, the graph Gφ is strongly from the implementation of an in-out ES-tree. connected. Moreover, the subtree of T rooted at φ is an G Lemma 2. Let G be a directed graph, n = |V (G)|, m = SCC-decomposition of φ. To build an SCC-decomposition T G |E(G)|, r ∈ V (G), and δ>0. of a strongly connected graph we pick an arbitrary vertex v, put it in the root of T , then recursively build SCC- • E The total time spent building an in-out ES-tree = decompositions of SCCs of G \{v} and make them the (G, r, δ, D) and handling all delete operations is v T v O mδ children of in . Since the choice of is arbitrary, there ( ). are many ways to build an SCC-decomposition of the same • The running time of each operation that lists vertices D D graph. As shown in [13], the total initialization and update of is linear in the size of . time of an SCC-decomposition is O(mγ), where γ is the • The running time of each operation that lists vertices depth of the decomposition. Thus, it is desirable to build of C ⊆ D that are unreachable from or cannot reach r G D decompositions of low depth. in is linear in the size of and the total degree of SCC-decomposition and separators: For any set S ⊆ D G vertices of (in ). V (G) we can build a partial SCC-decomposition of G by picking vertices of S (in arbitrary order). This results in a B. SCC-decomposition tree T where the vertices of S are at the top, and where the Ł˛acki [13] introduced a decomposition of a strongly leaves represent SCCs of G \ S. In the following we use G connected graph that can be efficiently updated under BUILD-SCC-DEC(G, S) to refer to this procedure. edge deletions. To solve the decremental SCC problem, such G S ⊆ a decomposition can be maintained for each SCC. His idea Lemma 4. Let be a directed graph and V G G, S was that, in terms of strong connectivity, a strongly connected ( ). BUILD-SCC-DEC( ) builds a partial SCC- T |S| T subgraph may essentially be viewed as a single vertex from decomposition with internal nodes. Each leaf of is G \ S the point of view of the rest of the graph. We can thus exactly the vertex set of one SCC of . The procedure O |E G |·|S| contract strongly connected subgraphs into single vertices and runs in ( ( ) ) time. separately maintain connectivity with respect to internal and Let T be a partial SCC-decomposition of G and φ be a external edges. We refer to Ł ˛acki’s decomposition as an SCC- leaf node of T . Note that if we modify T by replacing φ by a decomposition. An SCC-decomposition recursively partitions partial SCC-decomposition of G[φ], we obtain a new partial the graph G into smaller strongly connected subgraphs. This SCC-decomposition of G (in this case we say that we expand generates a rooted tree T , whose root r represents the entire φ). The node set of this new partial SCC-decomposition is graph, and where the subtree rooted at each node φ represents a finer partition of vertices of G.IfS is a small set of some strongly connected subgraph Gφ (we refer to vertices of vertices, such that the SCCs of G \ S are small, then the T as nodes to distinguish T from G). Every internal (non-leaf) SCC-decomposition computed by BUILD-SCC-DEC(G, S) node φ is a vertex of Gφ, and the children of φ correspond has low depth. Ł ˛acki[13] used this observation and the to SCCs of Gφ \ φ. The algorithm by Ł ˛ackirecursively planar separator theorem to obtain an O(n1.5) total update partitions the graphs until the leaves represent single vertices. time algorithm for the decremental SCC problem in planar We cut the recursion short and instead operate with partial graphs. The key insight of our result is that we may find a SCC-decompositions, in which the leaves represent strongly suitable set S in graphs of high diameter. Thus, we expand connected subgraphs rather than single vertices. each leaf φ of the SCC-decomposition when the diameter G Definition 3 (SCC-decomposition). Let G =(V,E) be a of φ grows large. Up to this point we maintain strong G strongly connected graph. An SCC-decomposition of is 1In this case, we sometimes abuse notation and assume that φ is the a rooted tree T , whose nodes form a partition of V . For a vertex itself.

316317 H Procedure Build-SCC-Dec(G,S) except i, as arguments. In this extended abstract, we do Input: A strongly connected graph G and S ⊆ V (G). not describe the procedures for updating the internal nodes Output: A partial SCC-decomposition T of G whose internal of an SCC-decomposition (e.g., FIX-SCC-DEC), as they are nodes are exactly the vertices of S. essentially the same as in [13].

1 if S = ∅ then III. OUR ALGORITHM 2 return the tree T consisting of a single node φ with associated graph Gφ = G. Our goal is to maintain the SCCs of a given directed 3 Pick an arbitrary vertex v ∈ S. graph G under edge deletions, and to answer in constant 4 Make v the root of T , and let Gv = G. time whether (arbitrary) pairs of vertices are in the same H ,...,H G \{v} 5 Compute the SCCs 1 t of . SCC. To answer such queries we assign a unique identifier to 6 foreach i ∈{ ,...,t} do 1 each SCC and store it with all its vertices. To check whether 7 Recursively compute Ti = BUILD-SCC-DEC(Hi,S∩ V (Hi)). two vertices are in the same SCC we simply check if their 8 Make the subtree Ti a child of v in T . identifiers match. We use essentially the same algorithm

9 return T . to solve the decremental single-source reachability (SSR) problem: to reduce decremental SSR to decremental SCC, simply add an edge from every vertex back to the source. A connectivity for the subgraph of the leaf with an in-out vertex is now reachable from the source if and only if it is ES-tree, which is efficient due to the low diameter. in the same SCC as the source in the modified graph. Handling deletions: We next very briefly sketch Ł ˛acki’s Consider the algorithm that maintains an in-out ES-tree procedure for maintaining an SCC-decomposition when an for each SCC of G. It uses the in-out ES-trees to detect when edge uv is deleted (see [13] for more details). Ł ˛ackidoes an SCC breaks, and then computes new in-out ES-trees for not consider partial SCC-decompositions, but his technique the resulting new SCCs. Roditty and Zwick [12] showed that easily extends to this case since all updates propagate toward when the root of every in-out ES-tree is chosen uniformly the root. In particular, a partial SCC-decomposition T of at random from its SCC, the total expected update time for a graph G is isomorphic to an SCC-decomposition of the a graph with n vertices and m edges is O(mn). We use the graph that is obtained from G by contracting the strongly same idea, but further reduce the update time by bounding connected subgraphs represented by the leaves of T . the depth of the in-out ES-trees. (The use of random roots The procedure for updating an SCC-decomposition T is a is also the only randomized element in our algorithm.) In recursive function that takes a node φ of T as a parameter, particular, the depth√ of all in-out ES-trees will be upper and possibly makes a single recursive call with the parent bounded by O( n). When the depth invariant of an in-out of φ. Thus, the update process is bottom-up and affects ES-tree is violated, we then need to maintain connectivity some number of immediate ancestor of φ. When node φ for the vertices that are too far from its root. is processed, some child node φ (and its subtree) may be Consider the case when the deletion of an edge uv causes moved up in the tree T , i.e., it becomes a sibling of φ.Ł˛acki the depth invariant of an in-out ES-tree E =(H, r, δ, D) to shows that the running time of this step is proportional to the be violated. Similar to the simple algorithm, our algorithm total degree of vertices in the subtree rooted at φ. Moreover, computes the set of vertices C ⊆ D that lost their strong the running time of such steps dominates the running time connectivity to the root r of E. It then removes C from E of the update procedure. Since nodes only move up in T , and recomputes in-out ES-trees for the new SCCs of H[C] it follows that maintaining the SCC-decomposition T under (using uniformly random sources). It is, however, possible edge deletions can be done in total time O(γm), where that the depth invariant remains violated for E or the new γ ≤ n is the initial depth of T . in-out ES-trees after C is removed. Note, however, that In this paper we modify the SCC-decomposition by H \ C is strongly connected at this point, and so are the new replacing subtrees of the SCC-decomposition with in-out SCCs by definition. The challenge is therefore to restore the ES-trees. We will call such an SCC-decomposition an depth invariant for an in-out ES-tree of a subgraph that we augmented SCC-decomposition. Let T be an augmented SCC- know is strongly connected. This is where we use Ł ˛acki’s decomposition. Whenever an edge uv is deleted, where u SCC-decomposition [13]. and v belong to distinct nodes of T , the in-out ES-trees are Let G0 be the original graph for which our data structure n |V G0 | not affected at all. On the other hand, when u and v belong is initialized, and let 0 = ( ) . Throughout, we use n G0 to the same leaf φ of T , we update the in-out ES-tree Eφ 0 to distinguish from other graphs and subgraphs for φ as follows. Let H1,...,H be the SCCs of Gφ \ uv. that we√ operate with. We√ also introduce two parameters: δ  n  q n / n We first update Eφ to represent the SCC Hi that contains the 0 =8 0 and 0 = 0 log 0 . We will use depth δ q root of Eφ, and then call FIX-SCC-DEC, which is a function threshold 0 for all our in-out ES-trees, and we refer to 0 for propagating the update in an SCC-decomposition. This as a quality parameter. We will later explain the significance δ q procedure is given SCC-decompositions of all H1,...,H, of 0 and 0.

317318 Procedure Fix-Depth(E) is sufficiently high, the partial SCC-decomposition will have no internal nodes, and we get the simple algorithm by Roditty Input: An in-out ES-tree E =(G, r, δ0,D) for a strongly connected graph G. and Zwick [12]. On the other hand, if the depth threshold Output: An augmented SCC-decomposition T of G, only allows in-out ES-trees consisting of single vertices, we consisting of a single tree. get Ł ˛acki’s algorithm [13]. Both algorithms use O(mn) total 1 if D = ∅ then update time, but for different reasons. To improve the running 2 Let T be the tree consisting of a single node φ with time we balance the depth of the partial SCC-decomposition G G E E associated graph φ = , and let φ = . and the depth of the in-out ES-trees against each other. This 3 return T is achieved by carefully choosing the depth threshold for G δ / 4 if More than half the vertices of have distance at most 0 2 the ES-trees, and by carefully selecting the internal nodes to r, and more than half the vertices of G have distance at for the partial SCC-decomposition. Note however that any most δ0/2 from r then 5 Compute S = FIND-SEPARATOR(G, r, δ0). choice of depth threshold and internal nodes gives a correct 6 Compute T = BUILD-SCC-DEC(G, S). algorithm; these choices only affect the running time. 7 Let φ1,...,φ ⊆ V (G) be the leaves of T . Before defining the choice of S in FIX-DEPTH(E),we {T ,...,T } 8 Compute 1  = first describe how an augmented SCC-decomposition T AUGMENTED-SCCS(E, {G[φ1],...,G[φ]}) uv i ∈{ ,...,} is updated when an edge is deleted. We refer to 9 foreach 1 do T,uv 10 Replace the leaf φi of T by the subtree Ti. DELETE-EDGE( ) for a formal description of the proce- T dure. As in Ł ˛acki’s algorithm [13], we first find the lowest 11 return . φ u v φ 12 else common ancestor of and , and if is an internal node 13 Destroy E. we proceed as in Ł ˛acki’s algorithm (we refer to this procedure 14 return BUILD-BALANCED-SCC-DEC(G). as DELETE-EDGE-FROM-SCC-DEC(T,uv)). If φ is a leaf, then we remove uv from the corresponding in-out ES-tree Eφ =(G[φ],rφ,δ0,Dφ), and if this does not break the depth Let G be a strongly connected graph, and let E = invariant then we are done. If the depth invariant of Eφ is (G, r, δ0,D) be an in-out ES-tree for G. Recall that T = violated, then we find the set Cφ of vertices that are not BUILD-SCC-DEC(G, S), where S ⊆ V (G), is a partial strongly connected to the root rφ of Eφ in G[φ]. We compute SCC-decomposition of G whose internal nodes are ex- the SCCs of G[Cφ], and compute an in-out ES-tree from a actly the vertices of S. When the depth invariant of E random root in every SCC. We also remove Cφ and all its is violated, our algorithm picks an appropriate set S, and incident edges from Eφ. (We ignore for now the case where computes the corresponding partial SCC-decomposition Eφ is destroyed and reconstructed.) We now have an in-out T = BUILD-SCC-DEC(G, S). The leaves of T are the ES-tree for every SCC of G[φ] \ uv, but since the depth SCCs of G \ S, and as before our algorithm recomputes invariant may be violated, we make a call to FIX-DEPTH(E) new in-out ES-trees for these SCCs, with the exception of for each such in-out ES-tree E. This gives us an augmented the SCC H that contains r, if a majority of the vertices in SCC-decomposition of every SCC of G[φ] \ uv. In fact H have distance greater than δ0/2 to or from r, respectively. this situation is virtually identical to the case in Ł ˛acki’s (We explain later why this distinction is important.) The algorithm [13] when an edge deletion breaks the strongly in-out ES-tree for H is instead obtained by removing connected subgraph of some internal node, and we proceed all vertices not in H from E. If the depth invariant is correspondingly: The augmented SCC-decomposition T+1 still violated for some of the resulting in-out ES-trees, that corresponds to the original in-out ES-tree Eφ replaces the procedure is repeated recursively, extending the SCC- φ in T , and the remaining augmented SCC-decompositions decomposition. In the end we are left with an augmented T1,...,T are attached higher in the tree T by making a call SCC-decomposition: A partial SCC-decomposition T for G, to FIX-SCC-DEC(T,uv,φ , {T1,...,T}), where φ is the where each leaf φ of T has an in-out ES-tree Eφ for G[φ]. The parent of φ in T . This is again done as in Łacki’s ˛ algorithm. procedure is described formally in FIX-DEPTH(E). It calls Note that if G[φ] \ uv is strongly connected (i.e., Cφ = ∅) the function AUGMENTED-SCCS(E, {G[φ1],...,G[φ]}), then this step is not needed. If φ has no parent and G[φ]\uv which constructs augmented SCC-decompositions for the has more than one SCC, then the new SCCs represented by SCCs G[φ1],...,G[φ], possibly by reusing the original in- T1,...,T are also new SCCs of the original graph G, and out ES-tree E (which will be detailed later). Note that we the identifiers of the vertices in these new SCCs are updated. S did not yet√ describe how the set is chosen, nor why we It remains to explain our use of the depth threshold, use δ0 =8 n0 as depth threshold. our choice of internal nodes for the augmented SCC- Our data structure for maintaining SCCs under edge decomposition, and when to destroy and recompute in-out deletions is thus a partial SCC-decomposition where the ES-trees. In order to make efficient use of Ł ˛acki’s SCC- leaves are represented by depth-bounded in-out ES-trees (an decomposition, we must make sure that the (combined) augmented SCC-decomposition). When the depth threshold initial depth is low. Recall from the discussion at the end

318319 Procedure Delete-Edge(T ,uv) Lemma 6. Let G be a strongly connected graph with n m r ∈ V G δ Input: An augmented SCC-decomposition T for a graph G, vertices and edges, let ( ), and let be an integer. and an edge uv to be deleted from G. Every leaf φ of Then the procedure FIND-SEPARATOR(G, r, δ) computes a q- T is associated with an in-out ES-tree separator for G with quality q = δ/(2 log n) in O(m) time Eφ =(G[φ],rφ,δ0,Dφ). if there exists a vertex v ∈ V (G) with either dist(r, v) ≥ δ or Output: An augmented SCC-decomposition T for dist(v, r) ≥ δ. If no such vertex v exists then the procedure G = G \ uv. returns the empty set. 1 Let φ = LCA(u, v) be the lowest common ancestor of u and v in T . Proof: Let T be the BFS tree that is produced by φ T 2 if is an internal node of then FIND-SEPARATOR(G, r, δ), i.e., T is rooted at r and has 3 return DELETE-EDGE-FROM-SCC-DEC(T ,uv). depth at least δ. If no such BFS tree exists, then the procedure uv E 4 Remove from the in-out ES-tree φ. returns the empty set as it should. We will assume for 5 if Dφ = ∅ then simplicity that δ is even. 6 return T L ⊆ V G i T T C ⊆ φ Let i ( ) be the th layer of . Observe that since 7 Using Lemma 2, compute the set φ of vertices that are L not strongly connected to rφ in G[φ]. is a BFS tree, each layer j separates the lower layers from 8 Compute the SCCs H1,...,H of the graph G[Cφ] induced the higher layers, that is, there are no edges from Li to Lk for C by φ. ij |Lk|}. Assume that the first 10 Compute {T1,...,T+1} = δ/2+1 layers L0,...,Lδ/ contain at most half the vertices AUGMENTED-SCCS(Eφ, {H1,...,H+1}). 2 G 11 Let φ be the parent of φ in T ,orletφ =  if φ has no of . (Otherwise we may reverse the order of the layers and parent. use an analogous argument.) This means that for j ≤ δ/2,we φ T T |L | j k , and thus the largest φ  C ∅ 13 if = or φ = then SCC of G\Lj has size at most |Lk| = n− |Li|. T {T,T ,...,T } k>j i≤j 14 return = 1  . Let q = δ/(2 log n) , and note that q log n ≤δ/2. Let 15 else T uv φ {T ,...,T } j be the lowest index such that q ≤ j ≤ q log n and 16 return FIX-SCC-DEC( , , , 1  ). j/q− |Lj|≤2 1. We show that such an index exists, and that Lj is a q-separator. The lemma then follows from the fact of Section II-B that this can be achieved by using good that Lj is computed in O(m) time. i/q−1 separators. We therefore introduce the following definition. Assume that |Li| > 2 for all q ≤ i q G V,E j− j−q− =0 Definition 5 ( -separator). Let =( ) be a graph with q 1 i/q−1 ≥ q 1 (i+q)/q−1 q + i=q 2 + i=0 2 = + n q ≥ q G  (j−q)/q j/q−1 vertices, and let 1 be an integer. A -separator for j−q−1 i/q 1−2 2 −1 2 = q + 1/q = q + 1/q . Note that is a non-empty set of vertices S ⊆ V , such that each SCC i=0 1−2 2 −1 /x x ≥ x ≥ 1/x − ≤ /x of G \ S contains at most n − q ·|S| vertices. We refer to q (1+1 ) 2 for 1, which implies that 2 1 1 . j−1 |L | >q j/q−1 − · q q · j/q−1. as the quality of S. Hence, i=0 i +(2 1) = 2 Assume by contradiction that there is no index j such j/q− For our application it is desirable for separators to have that q ≤ j ≤ q log n and |Lj|≤2 1. Then as high quality as possible. However, since no SCC contains |L | > i/q−1 q ≤ i ≤ q n i 2 for all log , which means that fewer than one vertex, every q-separator S must have q·|S| < q log n q n /q− 1 q n /q |Li| >q· 2( log +1) 1 ≥ · 2( log ) = n G, r, δ i=0 2 . We next describe a procedure FIND-SEPARATOR( ) n/2. Since q log n ≤δ/2, this contradicts the assumption for computing a high-quality separator for a graph with a L ,...,L that the layers 0 δ/2 contain at most half the vertices high diameter. The procedure starts by computing a BFS tree G j  of , and therefore there must exist a lowest index such T rooted at r for either G or the reversed graph G, such that j/q− that q ≤ j ≤ q log n and |Lj|≤2 1. T δ has depth at least . If no such tree exists the procedure |L | > i/q−1 q ≤ i combined with j 2  , this implies that i=0 i T to be the set of vertices at distance i from the root v in j/q− j−1 q·2 1 ≥ q·|Lj|. Since |Li|≤n/2 this also implies T . We now consider two cases: Either the layers from 0 i=0 that |Lj| j i≤j j−1 |L |≤n − q ·|L | . L ∅ we let j be the lowest index such that q ≤ j ≤ δ/2 and i=0 i j Since j = , this proves that j/q− L q |Lj|≤2 1. We show that such an index exists, and that j is a -separator, and the lemma follows. G, r, δ Lj is a q-separator. We thus let FIND-SEPARATOR(G, r, δ) Note that when we call FIND-SEPARATOR( √) on E δ  n  return Lj. In the second case, we similarly return the layer line 5 in FIX-DEPTH( ) we use depth√ 0 =8 0 , δ /  n  Lj, where j is the highest index such that δ/2 ≤ j ≤ δ − q whereas we only use depth 0 4=2 0 on line 2 δ−j /q− G and |Lj|≤2( ) 1. in BUILD-BALANCED-SCC-DEC( ). It then follows from

319320 O m δ n Procedure Build-Balanced-SCC-Dec(G) time spent√ on maintaining ES-trees is ( 0 0 log 0)= O m n n Input: A strongly connected graph G. ( 0 0 log 0). Unfortunately, it is not true that every Output: An augmented SCC-decomposition T of G. new in-out ES-trees has half the size of the graph that it

1 Pick an arbitrary vertex v ∈ V (G). came from. To fix the argument we exploit that the root of 2 Compute S = FIND-SEPARATOR(G, v, δ0/4). the in-out ES-tree was picked uniformly at random. 3 if S = ∅ then Consider the point at which half the vertices from r ∈ V G 4 Pick ( ) uniformly at random. the original graph G of an in-out ES-tree FIX-DEPTH(E) 5 return FIX-DEPTH(BUILD-ES-TREE(G, r, δ0)). have distance greater than δ0/2 to or from the root r of 6 else IX EPTH E 7 Compute T = BUILD-SCC-DEC(G, S). F -D ( ), respectively. (Note that this includes the 8 Let φ1,...,φ ⊆ V (G) be the leaves of T . case where half the vertices are unreachable, i.e., have infinite 9 Let imax = arg maxi≤ |φi|. distance to or from r.) Since r ∈ V (G) was chosen uniformly 10 foreach i ∈{1,...,}\{imax} do at random, with probability 1/2 the situation would have v ∈ φ 11 Pick i i uniformly at random. been similar for half of the choices of roots. This restricts 12 Compute Ei = BUILD-ES-TREE(G[φi],vi,δ0) the structure of the graph, and we prove that in this case we 13 Compute Ti = FIX-DEPTH(Ei). q 14 Replace the leaf φi of T by the subtree Ti. can repeatedly remove 0-separators from the largest SCC until it is reduced to half the size of the original graph. To do 15 Compute G Timax = BUILD-BALANCED-SCC-DEC(G[φimax ]). so we use the function BUILD-BALANCED-SCC-DEC( ). 16 Replace the leaf φimax of T by the subtree Timax . We then get that each vertex only appears in a logarithmic 17 return T . number of in-out ES-trees in expectation. In order to repeat the argument, we destroy and recompute FIX-DEPTH(E)

Procedure Augmented-SCCs(E, {H1,...,H}) before calling BUILD-BALANCED-SCC-DEC. G0 Input: An in-out ES-tree E =(G, r, δ0,D), and a collection To initialize our data structure for some given graph , H ,...,H G0 {H1,...,H} of disjoint, strongly connected we compute the SCCs 1  of , and then for each G i ≤  E subgraphs of . , we√ compute an in-out ES-tree i with depth threshold Output: A collection of augmented SCC-decompositions δ0 =8 n0 from a random source ri in Hi. For each {T1,...,T}, such that Ti is an augmented i ≤  we then call FIX-DEPTH(Ei) to get an augmented SCC-decomposition for Hi. SCC-decomposition. 1 Let imax = arg maxi≤t |Hi|. r ∈ φ 2 if imax then IV. DECREMENTAL MAINTENANCE OF SCCS 3 Remove V (Himax ) and its adjacent edges from E. Let G =(V,E) be the initial graph, and let Gj be the 4 Compute Timax = FIX-DEPTH(E). j G 5 else graph after edges have been deleted from . In particular 0 j 6 Destroy E, and compute G = G. Also let T be the partial SCC-decomposition T H j imax = BUILD-BALANCED-SCC-DEC( imax ). that our algorithm constructs for G . In this section we 0 0 7 foreach i ∈{1,...,}\{imax} do let m0 = |E(G )| and n0 = |V (G )|. To bound the 8 Pick vi ∈ φi uniformly at random. running time of the operations that modify our partial SCC- E H ,v ,δ 9 Compute i = BUILD-ES-TREE( i i 0). decomposition, we use the following function that assigns 10 Compute Ti = FIX-DEPTH(Ei). potential to a partial SCC-decomposition T of a graph G.We {T ,...,T } 11 return 1  . will separately bound the time spent on building and updating the ES-trees. Let v ∈ V (G). We denote by levelT (v) the depth in T of the node that contains v. Then, the potential Lemma 6 that√ the produced separators√ always have quality  function is given by T v · T v . at least q =  n0/ log n ≥ n0/ log n0 = q0.Weuse Φ( ):= v∈V (G) degG( ) level ( ) The analysis by Ł ˛acki[13] can be interpreted as showing this to show that the combined increase in depth for√ the partial that the total time spent updating internal nodes of an SCC- SCC-decomposition is at most O(n0/q0)=O( n0 log n0), decomposition T is O(Φ(T )). This is done by charging work which means that the total time√ spent on maintaining the performed by the algorithm to a decrease of the potential. SCC-decomposition is O(m0 n0 log n0), where m0 is the number of edges in the initial graph. Let us first briefly analyze how each function affects the To bound the time spent on in-out ES-trees, one could levels of vertices. try to argue that every time a new in-out ES-tree is created, 1) As noted in Section II-B the procedure for updating it will contain at most half of the vertices from the graph the internal nodes of a partial SCC-decomposition after that it came from. This would imply that every vertex only deleting an edge, may only decrease the levels. appears in a logarithmic number of in-out ES-trees. Since 2) Each call to FIX-DEPTH may result in replacing a the contribution of one vertex to the work performed by leaf node of an SCC-decomposition with a multi-level an ES-tree is proportional to its degree multiplied by the subtree computed with BUILD-SCC-DEC. Thus, these maximum depth of the ES-tree, it would follow that the total two operations may only increase the levels of vertices.

320321 In [13], the SCC-decomposition is first built, which Lemma 10. The total time spent in FIND-SEPARATOR, accumulates some potential, and then the potential may only BUILD-BALANCED-SCC-DEC and BUILD-SCC-DEC,ex- drop. Thus, in order to bound the running time it suffices cluding the case when FIND-SEPARATOR returns√ the empty to bound the initial potential. In our case, we bound the set in BUILD-BALANCED-SCC-DEC,isO(m0 n0 log n0). total potential increase caused by calls to FIX-DEPTH and Lemma 10 accounts only for a part of the time spent BUILD-SCC-DEC. The level of a vertex v only increases by calls to FIX-DEPTH. We attribute the remainder of the if v belongs to a leaf. When v is an internal node of the work of FIX-DEPTH to handling in-out ES-trees, which we SCC-decomposition, its level only decreases. describe in Section IV-A. We also still need to bound the There are two atomic operations that modify SCC- running time of FIX-SCC-DEC and DELETE-EDGE-FROM- decompositions. The first one moves a node one level up SCC-DEC, but as it depends on the analysis of in-out ES- (in the procedure for updating partial SCC-decomposition). trees, we postpone it to Lemma 15. The second consists of expanding a leaf node of an SCC- decomposition to a multilevel subtree computed with BUILD- A. ES-trees SCC-DEC. The leaves of this subtree may then be recursively We first show that the costs of all DELETE-EDGE op- expanded with other subtrees. For the purpose of our analysis, erations on an ES-tree are dominated by the cost of the we track the levels of nodes (and the potential) after each BUILD-SCC-DEC operation and the cost of all FIX-DEPTH such atomic operation. Note that whenever we build an in- operations. The proofs of the following two lemmas are out ES-tree for a graph on n ≤ n0 vertices, we use the depth δ q deferred to the full paper. threshold√ 0. This allows us to find 0-separators, where q0 = n0/ log n0 . Lemma 11. Let m0 = |E(G0)| and n0 = |V (G0)|. The We now analyze BUILD-SCC-DEC(G, S). This function total running time of all FIX-DEPTH operations (excluding O is called by FIX-DEPTH and BUILD-BALANCED-SCC-DEC, the ones√ that exit immediately and take (1) time) is and it calls itself recursively. We refer to the first two cases O(m0 n0 log n0). as initial calls to BUILD-SCC-DEC. The following lemma Lemma 12. The total time spent inside DELETE-EDGE (that follows from Lemma 6 and the fact that S is constructed √ is, excluding the calls to DELETE-EDGE-FROM-SCC-DEC, by FIND-SEPARATOR(G, r, δ), where δ ≥ δ0/4=2 n0, FIX-DEPTH, FIX-SCC-DEC, and BUILD-BALANCED-SCC- i.e., the procedure returns a q0-separator, where q0 = √ DEC) is dominated by the time spent on building the ES-tree n0/ log n0 . and calls to FIX-DEPTH. Lemma 7. In each initial call to BUILD-SCC-DEC(G, S), √ For every leaf φ of each partial SCC-decomposition we S is a q0-separator of G, where q0 = n0/ log n0 . maintain an in-out ES-tree representing Gφ. As the in-out v ∈ G0 v Lemma 8. Let . The total increase in the√ level of in ES-trees in the leaf nodes are subdivided, new in-out ES-trees the course of handling all edge deletions is O( n0 log n0). have to be built. Proof: Observe that the level of v only increases when v Lemma 13. Let φ be a leaf of an augmented SCC- belongs to a leaf of the partial SCC-decomposition, and this decomposition, let n = |φ|, let G[φ] be the subgraph corre- leaf is expanded to a partial SCC-decomposition built with sponding to φ at the time that the leaf was created, and let H, S a call BUILD-SCC-DEC( ). We claim that in this case Eφ =(G[φ],rφ,δ0,Dφ) be the in-out ES-tree for φ. In partic- the size of the node containing v decreases significantly. ular rφ is a uniformly random vertex from φ. Then until Eφ is By Lemma 4, BUILD-SCC-DEC(H, S) builds an SCC- destroyed, every new in-out ES-tree created for a subgraph of T |S| decomposition of depth at most , where each leaf G[φ] contains at most n/2 vertices. Let Hmax be the largest H \ S S corresponds√ to an SCC of . By Lemma 7, is a SCC of the graph for Eφ right before Eφ is destroyed, and let n / n H H \ S T H 0 log 0 -separator of √. Hence, each SCC of max = BUILD-BALANCED-SCC-DEC( max). Then with |V H |− n / n |S| has size at most ( ) 0 log 0 . Thus, when probability 1/2 the largest leaf of Tmax contains at most v T v the leaf containing is replaced with , the level of n/2 vertices, and the SCCs other than Hmax also contain |S| increases by at most .√ Since the size of the set containing at most n/2 vertices. v is reduced by at least n0/ log n0 |S|, the level of v can √ Proof: We only sketch the proof. Additional details can increase at most n0 log n0 times. be found in the full version of the paper. Corollary 9. The total potential increase√ in the course of Observe that we destroy Eφ as soon as we cut away more O m n n handling all edge deletions is ( 0 0 log 0). than half of its vertices. Therefore, every new in-out ES-tree G φ E The following lemma follows from Corollary 9, and that is created from [ ] before φ is destroyed can at most n/ E the fact that FIND-SEPARATOR is guaranteed to find a q - contain 2 vertices. Also, when φ is destroyed, only the 0 H separator when it is called from BUILD-SCC-DEC. largest SCC max of its subgraph at that time can contain more than n/2 vertices. To prove the lemma it therefore

321322 suffices to show that the largest leaf of Tmax contains at from a graph only increases the distance between pairs of most n/2 vertices with probability 1/2. vertices, it follows that distances to and from vi in H are (i) Once the root rφ of Eφ is chosen, the remainder of our at least as large as in H . The key observation is then that algorithm for handling Eφ is deterministic, given a fixed Ei was destroyed because at most n/2 vertices had distance δ / v H(i) sequence of edge deletions e1,e2,...,es. For every choice at most 0 2 to or from i in , respectively. Since the of rφ, we may therefore ask how many edges from the same is true for H, it follows from dist(vi,v) <δ0/2 and sequence are deleted before the algorithm destroys Eφ.In dist(v, vi) <δ0/2 for all v ∈ V (H) that |V (H)|≤n/2, particular, we may sort the vertices of G[φ] in non-decreasing which contradicts our assumption that |V (H)| >n/2. (i) order according to the time it takes for the resulting in-out We use a similar argument to prove that Sj ∩ V (H)=∅ j ∈{,..., } ES-tree to be destroyed. Let v1,v2,...,vn be this sequence. for all 1 i . The key property we use from For some choice of a root vi, let Ei be the corresponding our algorithm is that when we compute a separator on i i i G φ S( ),S( ),...,S( ) ⊆ φ line 5 of FIX-DEPTH, more than half of the vertices have in-out ES-tree for [ ], let 1 2 i be the sequence of separators that are removed from G[φ] up to distance at most δ0/2 to and from the root of the in-out the point where Ei is destroyed, and let t(i) be the number ES-tree, respectively. This means that in FIND-SEPARATOR e ,...,e of edges 1 t(i) that are deleted before this happens. the constructed separator only contains vertices with distance (i) δ / (Note that t(i) ≤ t(j) for i ≤ j.) Finally, let G be what at least 0 2 either to or from this root. i remains of G[φ] right before Ei is destroyed, i.e., G( ) = G n |V G | m (i) (i) Lemma 14. Let be a graph, with = ( ) and = (G[φ] \ (S ∪ ...∪ S )) \{e1,...,et i }. |E G | G 1 i ( ) ( ) . Assume that edges are deleted from . For√ each Let vr = rφ be the chosen root. Observe that with SCC we maintain an in-out ES-tree up to depth O( n) (n probability 1/2 at least n/2 vertices appear before vr in is the current size of the SCC) rooted in a vertex chosen v ,v ,...,v the sequence 1 2 n. If this is not the case, then we uniformly at random. After edges are deleted and an SCC ignore the outcome, so for the remainder of the proof we will H is partitioned into H1,...,Hk we do the following. Let r assume that appears in the second half of the sequence. Wi be the SCC containing the root of the in-out ES-tree E Recall that BUILD-BALANCED-SCC-DEC(Hmax) repeat- of H.IfWi contains at least n/2 vertices then we reuse edly removes a separator from Hmax. We must therefore show the in-out ES-tree E of H in the SCC Wi and for j = i that we can keep doing this until the largest SCC contains at we build new in-out ES-trees for Hj.IfWi contains less most n/2 vertices. To do so we prove the following claim. than n/2 vertices then we invoke the procedure BUILD- Let S be any (possibly empty) subset of φ, and suppose that BALANCED-SCC-DEC. Then, maintaining all the in-out ES- G(r) \ S H n/ has an SCC with more than 2 vertices. Then trees√ and all calls to BUILD-BALANCED-SCC-DEC requires we show that for every vi ∈ V (H) with i ≤ n/2, there exists O(m n log n) expected time. some vertex v ∈ V (H) such that either dist(vi,v) ≥ δ /2 0 Proof: Maintaining an in-out ES-tree with depth thresh- or dist(v, vi) ≥ δ /2 in H. Since |V (H)| >n/2 there is √ 0 old Θ( n) of a graph that initially has m edges and n at least one vi ∈ V (H), which implies that the diameter √ vertices requires O(m n) time. For simplicity, we may of H is at least δ /2. For every u ∈ V (H ), there 0 max charge all this time to the initialization of the in-out ES-tree therefore exists some vertex v ∈ V (H ) such that either max and ignore the constant factor. Thus, in the following we dist(v, u) ≥ δ /4 or dist(u, v) ≥ δ /4 in H . Hence √ 0 0 max assume that this time is exactly m n. FIND-SEPARATOR(Hmax,u,δ0/4) finds a q0-separator for We bound separately the time spend for the calls of BUILD- any u ∈ V (Hmax). To repeat the argument we let S be the BALANCED-SCC-DEC and the time for the ES-trees. Recall union of the separators produced so far. that we call BUILD-BALANCED-SCC-DEC in the case where Suppose the largest SCC H of G(r) \ S has more than Wi contains less than half of the vertices. Every recursive n/2 vertices. We then prove by contradiction that for every call of BUILD√ -BALANCED-SCC-DEC spends O(m) time vi ∈ V (H) with i ≤ n/2, there exists some vertex v ∈ to find a n/ log n -separator√ S. Since every time the V (H) such that either dist(vi,v) ≥ δ /2 or dist(v, vi) ≥ 0 largest SCC is at least n/ log n vertices smaller that δ0/2 in H. Hence we assume that dist(vi,v) <δ0/2 and the√ SCC it belonged previously, this can happen at most dist(v, vi) <δ /2 for some vi ∈ V (H) and all v ∈ V (H). 0 n log n times. By Lemma 13 the probability that a call to S(i),S(i),...,S(i) ⊆ φ Consider the separators 1 2 i that would FIND-SEPARATOR returns S = ∅ before BUILD-BALANCED- v E have been generated if we had chosen i as the root of i, SCC-DEC halts is at most 1/2. Thus, in expectation the H(i) v G(i) √ and consider the SCC that contains i in . We prove number of call to FIND-SEPARATOR is O( n log n). This S(i) ∩ V H ∅ j ∈{ ,..., } √ by induction that j ( )= for all 1 i . results in total O(m n log n) expected time in the calls (i) This implies that H is a subgraph of H . Indeed, then H is to FIND-SEPARATOR from BUILD-BALANCED-SCC-DEC. G G(r) \S \ S(i) ∪...∪S(i) also an SCC of =( ) ( 1 i ), and since Additionally, all calls to FIX-DEPTH and BUILD-ES-TREE (i) G is a subgraph of G it follows that vi can only be part are bounded below. By Lemma 10, the time√ spent on calls of of a smaller SCC in G . Since removing edges and vertices BUILD-SCC-DEC is bounded by O(m n log n). Thus, the

322323 total time spent on calls of BUILD-BALANCED-SCC-DEC, by the EU FET project MULTIPLEX no. 317532 and the Google excluding the time√ for building and maintaining the in-out Focused Award on "Algorithms for Large-scale Data Analysis". O m n n ES-trees, is ( log ) in expectation. REFERENCES We next analyze the time for all ES-trees. Note that we initiate new ES-trees only for SCCs that are of size at most [1] M. R. Henzinger and M. Thorup, “Sampling to provide or to bound: With applications to fully dynamic graph algorithms,” half their previous SCC. Therefore, every node belongs to at Random Struct. Algorithms, vol. 11, no. 4, pp. 369–379, 1997. most O(log n√) ES-trees. Thus for all trees the total update time is O(m n log n). In the second case, by Lemma 13 [2] J. Holm, K. de Lichtenberg, and M. Thorup, “Poly-logarithmic with constant probability all the SCCs are at most a constant deterministic fully-dynamic algorithms for connectivity, min- fraction of the size of the original SCC. As mentioned above, imum spanning tree, 2-edge, and biconnectivity,” J. ACM, vol. 48, no. 4, pp. 723–760, 2001. w.h.p. this happens to every node√ at most O(log n) times. Thus this part also costs O(m n log n) total update time. [3] J. Holm, E. Rotenberg, and C. Wulff-Nilsen, “Faster fully- dynamic minimum spanning forest,” in Proc. of 23rd ESA, It remains to bound the running time of FIX-SCC-DEC 2015, pp. 742–753. and DELETE-EDGE-FROM-SCC-DEC (the proof is deferred [4] M. Thorup, “Near-optimal fully-dynamic graph connectivity,” to the full version). in Proc. of 32nd STOC. ACM, 2000, pp. 343–350. Lemma 15. The total expected running time of FIX- [5] C. Wulff-Nilsen, “Faster deterministic fully-dynamic graph SCC-D√ EC and DELETE-EDGE-FROM-SCC-DEC is connectivity,” in Proc. of 24th SODA, 2013, pp. 1757–1769. O(m n log n). [6] B. M. Kapron, V. King, and B. Mountjoy, “Dynamic graph B. Main result connectivity in polylogarithmic worst case time,” in Proc. of 24th SODA, 2013, pp. 1131–1142. Lemma 16. Let G be a strongly connected graph subject to edge deletions, n = |V (G)| and m = |E(G)|. Then, [7] M. Henzinger, S. Krinninger, and D. Nanongkai, “Sublinear- we can√ maintain SCC-decompositions of all SCCs of G in time decremental algorithms for single-source reachability and O(m n log n) expected time. shortest paths on directed graphs,” in Proc. of 46th STOC, 2014, pp. 674–683. Proof: Consider the operations one by one. The total expected time spent on BUILD-ES-TREE and on updating [8] ——, “Improved algorithms for decremental single-source all the ES-trees in the leaves of the SCC-decomposition is reachability on directed graphs,” in Proc. of 42nd ICALP, √ 2015, pp. 725–736. O(m n log n) by Lemma 14. On the other hand, finding√ sep- arators and all calls to BUILD-SCC-DEC take O(m n log n) [9] S. Even and Y. Shiloach, “An on-line edge-deletion problem,” time, by Lemma 10. The running time of FIX-DEPTH is split J. ACM, vol. 28, no. 1, pp. 1–4, 1981. between finding the separators, calling BUILD-ES-TREE and performing operations that are dominated by the running time [10] Y. Dinitz, “Dinitz’ algorithm: The original version and Even’s version,” in Theoretical Computer Science, Essays in Memory of BUILD-ES-TREE. We have already accounted for each of of Shimon Even, 2006, pp. 218–240. these cases. The cost of DELETE-EDGE operations on in-out ES-trees can be charged to other operations, by Lemma 12. [11] G. F. Italiano, “Finding paths and deleting edges in directed Finally, the total time spent in all the DELETE-EDGE acyclic graphs,” Inf. Process. Lett., vol. 28, no. 1, pp. 5–11, 1988. operations executed on√ internal nodes of SCC-decompositions O m n n is bounded by ( log√ ) by Lemma 15. Therefore, the [12] L. Roditty and U. Zwick, “Improved dynamic reachability total running time is O(m n log n). algorithms for directed graphs,” SIAM J. Comput., vol. 37, no. 5, pp. 1455–1471, 2008. Theorem 17. Let G be a directed graph, n = |V (G)| and m = |E(G)|. There exists an algorithm for maintaining [13] J. Lacki, “Improved deterministic algorithms for decremen- strongly connected components of G subject√ to edge deletions, tal reachability and strongly connected components,” ACM that processes edge deletions in O(m n log n) total expected Transactions on Algorithms, vol. 9, no. 3, p. 27, 2013. time and at any point is able to answer queries that ask [14] L. Roditty, “Decremental maintenance of strongly connected whether two vertices are contained in the same strongly components,” in Proc. of 24th SODA, 2013, pp. 1143–1150. connected in O(1) time. It uses O(m + n) space. [15] V. King, “Fully dynamic ,” in Encyclopedia ACKNOWLEDGMENT of Algorithms. Springer, 2008. S. Chechik is supported by the Israel Science Foundation (grant no. 1528/15), T. D. Hansen by the Carlsberg Foundation, grant [16] R. E. Tarjan, “Depth-first search and linear graph algorithms,” no. CF14-0617, G. F. Italiano by MIUR under Project AMANDA SIAM J. Comput., vol. 1, no. 2, pp. 146–160, 1972. (Algorithmics for MAssive and Networked DAta), and J. Ł ˛acki

323324