Improved Deterministic Algorithms for Decremental ... - CiteSeerX

Report 2 Downloads 113 Views
Improved Deterministic Algorithms for Decremental Transitive Closure and Strongly Connected Components Jakub Łącki∗ Abstract This paper presents a new deterministic algorithm for decremental maintenance of the transitive closure in a directed graph. The algorithm processes any sequence of edge deletions in O(mn) time and answers queries in constant time. Until now such time bound has only been achieved by a randomized Las Vegas algorithm. In addition to that, a few decremental algorithms for maintaining strongly connected components are shown, whose time complexity is O(n1.5 ) for planar graphs, O(n log n) for graphs with bounded treewidth and O(mn) for general digraphs.

1 Introduction In this paper we consider decremental maintenance of the transitive closure in a directed graph. We present a data structure, which supports two operations: • query(u, v) — check if there is a directed path from u to v, • delete(u, v) — delete an edge from u to v. The data structure is based on a novel representation of a strongly connected graph, which might be of independent interest. The problem of dynamic maintenance of the transitive closure has been given attention in recent years (e.g. [1], [2], [3], [4], [5], [6], [7]). In this paper, we focus on algorithms with constant query time. One of the most natural measures of efficiency of such algorithms is the total time needed to process an arbitrary sequence of updates. In particular, for decremental graph problems one usually bounds the total time needed to update the data structure if all the edges are eventually deleted (in arbitrary order). This is a natural choice for algorithms such as maintenance of the transitive closure, since deleting a single edge might affect as much as Θ(n2 ) cells in the transitive closure matrix. 1.1 Previous Results Two O(m2 ) deterministic decremental algorithms were obtained independently, one by La Poutr´e and van Leeuwen [5] and the other by Frigioni et al. [2]. Demetrescu and Italiano [7] gave ∗ Institute of Informatics, University of Warsaw, Poland, [email protected]

an O(n3 ) deterministic algorithm, which is faster for dense graphs. Since all those three algorithms maintain the transitive closure explicitly, each query can be answered in constant time. These results have been improved with randomized algorithms. Henzinger and King [4] gave a Monte Carlo algorithm, which is capable of handling arbitrary digraphs with total update time of O(mn log2 n). However, it does not maintain the transitive closure explicitly and needs as much as O( logn n ) time for each query. √ Baswana et al. showed an O(mn4/3 3 logn) Monte Carlo algorithm [6], whereas Roditty and Zwick [1] obtained an O(mn) Las Vegas algorithm. Both those algorithms handle queries in constant time. The problem of decremental maintenance of strongly connected components has been addressed less often. An algorithm suggested by Frigioni et al. [2] requires O(m2 ) worst-case time, which is as slow as recomputing the strongly connected components after each update from the beginning. However, if all deleted edges are randomly selected, the expected time is O(mn). Roditty and Zwick [1] showed a Las Vegas algorithm which maintains strongly connected components in O(mn) total expected time for any sequence of edge removals. 1.2 Our Results We present an algorithm that maintains the structure of strongly connected components over a sequence of edge deletions in O(mn) total time. It is based on a very simple representation of a strongly connected component, which reduces the problem of decremental strong connectivity to maintaining connectivity in a set of directed acyclic graphs. Using our algorithm, we obtain a deterministic decremental O(mn) algorithm for transitive closure with constant query time, thus solving an open problem posed by Roditty and Zwick in [1]. This is a significant advancement over the best currently known deterministic algorithms, which run in O(m2 ) or O(n3 ) total time. Moreover, we give two algorithms for decremental maintenance of strongly connected components in special classes of graphs. Firstly, we obtain O(n1.5 ) time complexity for planar graphs. To the best of our knowl-

1438

Copyright © by SIAM. Unauthorized reproduction of this article is prohibited.

Figure 1: An example graph and the first steps of building the representation. edge, the currently best algorithm that can be used to solve this problem is a dynamic reachability algorithm for planar graphs presented by Diks and Sankowski [8]. √ 3 n log n) It handles edge deletions and queries in O( √ and O( n log2 n) time respectively, though it has to be noted that it also supports inserting edges. In addition, we show an algorithm for decremental maintenance of strongly connected components in graphs with treewidth bounded by a constant, which runs in O(n log n) time. We have not found any comparable algorithms solving this problem. The rest of this paper is organized as follows. In the next section, we describe a strongly connected component tree, which is a tree-like data structure for representing strongly connected graphs, capable of efficient updates after edge deletions. Using this structure, in section 3 we show how to decrementally maintain the transitive closure. The last part of the paper shows how to build strongly connected component trees of smaller size for planar graphs and graphs with bounded treewidth and obtain more efficient algorithms for these classes of graphs.

Since the edges can only be deleted, the SCCs only decompose. In the beginning, we partition the graph into SCCs, using a standard linear-time algorithm (see e.g. [14]) and after that we work with each SCC separately. From now on, we assume that G is initially strongly connected. 2.1 Graph Representation The algorithm starts by building a graph representation, that allows us to find changes in the structure of SCCs. The representation is defined recursively.

2

1. A single-vertex SCC represents itself. 2. To build a representation of a larger SCC, choose an arbitrary vertex v and split it into two vertices vin and vout . The edges incident to v are distributed between those new vertices. The former has all the incoming edges and the latter all edges leaving v. After that the graph is no longer strongly connected. Find all SCCs and contract them to vertices, thus obtaining a directed acyclic graph (DAG) D. Vertices of D are sets of vertices of the original graph. The representation consists of D and a list of representations of the contracted SCCs.

Decremental Maintenance of Strongly Connected Components In this section we present an algorithm for maintaining strongly connected components (SCCs) under a seThe process of building the representation has been quence of edge deletions. It takes a directed graph G shown in Figure 1. As a result, we get a tree depicted with n vertices and m edges as input. in Figure 2, which we call an SCC tree. Its root The algorithm handles the following operations: corresponds to the entire graph. An inner node, which • query(u, v) — check if u and v are in the same SCC, contains a DAG D, has children representing all vertices of D, with the exception that for every vertex v, which • delete(u, v) — delete an edge from u to v. is split during the construction of the tree, we only have After an initialization in O(mn) time, it takes O(1) one child instead of two separate children for vin and time to answer each query and the total running time of vout . Note that D can have multiple edges. The leaves all delete operations amounts to O(mn). Hence, if all correspond to vertices of the original graph. To prevent edges are eventually removed, the amortized running ambiguity, from now on node will refer to a vertex of time of a single query is O(n). an SCC tree, so that it would not be confused with

1439

Copyright © by SIAM. Unauthorized reproduction of this article is prohibited.

Figure 2: An example SCC tree of the graph from figure 1. The root node R corresponds to the entire graph.

vertices of the original graph. We will use capital letters to denote nodes and lowercase letters to denote vertices. The depth of the tree is δ = O(n), since it has n leaves and each inner node has at least two children. The tree has O(n) nodes, each containing a partition of a subset of vertices of G. Each edge of G is stored in only one node, namely, an edge (u, v) is kept in the lowest common ancestor of the leaves corresponding to u and v. Vertices in a node N of the tree correspond to a child nodes of N , except for the leaf nodes, which correspond to vertices of the original graph. This implies that there are O(n) vertices in all DAGs in the tree in total. Recall that each vertex, say v, of each DAG in a node of the SCC tree is a subset of vertices of the original graph. Those subsets do not have to be stored explicitly, as is sufficient to iterate through the whole subtree corresponding to v to create a required set in linear time. Hence, the resulting structure uses O(n + m) space. The tree can be built in O(mδ) time, using a lineartime algorithm for finding SCCs, because it takes O(m) total time to build each level of the tree. This leads to the following lemma: Lemma 2.1. An SCC tree can be constructed in O(mδ) time, where δ is the depth of the resulting tree. It requires O(n + m) space. 2.2 Edge Deletions in DAGs Each inner node of an SCC tree contains a DAG with one source and one sink. We use the following lemma to detect changes in the set of vertices reachable from the source.

edges and find the longest walk starting from v. The graph does not have any cycles, so the walk has finite length. It can only end in a source and the only source is s. We need an auxiliary function find-unreachabledown(G, S), which utilizes this lemma. For a set of deleted edges, whose endpoints’ set is S, it returns a subgraph of vertices that become unreachable from the source together with their incident edges. Algorithm 1 find-unreachable-down((V, E), S) Require: (V, E) is a single source DAG Require: S ⊂ V 1: add all vertices from S with no incoming edges to a queue Q 2: U = ∅ {unreachable vertices} 3: I = ∅ {their incident edges} 4: while Q 6= ∅ do 5: v = DEQU EU E(Q) 6: if v is not the source then 7: U = U ∪ {v} 8: I = I ∪ IN CIDEN T -EDGES(v) 9: for all (v, w) ∈ E do 10: E = E \ {(v, w)} 11: if w has no incoming edges then 12: EN QU EU E(Q, w) 13: return (U, I)

Lemma 2.2. In a DAG with a single source s, a vertex Lemma 2.3. If a DAG has only one source, then after v becomes unreachable from s after removing an edge deleting a set of edges incident to vertices from a set S, find-unreachable-down((V,E),S) returns a pair (U, I), (u, v) iff (u, v) was the only incoming edge for v. where U is the set of all the vertices that become Proof. We will show that as long as v has incoming unreachable from the source and I is the set of their edges, there exists a path from s to v. Reverse the incident edges. It runs in O(|S| + |I|) time.

1440

Copyright © by SIAM. Unauthorized reproduction of this article is prohibited.

Figure 3: Deleting an edge (6,10) from an example DAG in an SCC tree root. The dotted arrows represent edges from the set I. The last picture shows the DAG D0 .

Proof. Fix a topological ordering v1 , v2 , v3 , ... of the DAG. The proof proceeds by induction, we will show that for each nonnegative integer k, the procedure correctly identifies the unreachable vertices among v1 , . . . , vk . The basis of the induction when k = 0 is trivial. Let us now assume that k > 0. There are two ways for a vertex vk to become unreachable from the source. Either it has no incoming edges or all its direct predecessors are not reachable. The first line handles the first case, as every vertex inserted to queue Q, except for the source, is later added to U . If all direct predecessors of vk are not reachable, then, by the induction hypothesis, they have been correctly identified by the algorithm and all their outgoing edges have been deleted in the 10th line of the pseudocode. Consequently, vk is also inserted to Q. This proves the correctness of the function. To show the running time, we first observe that the check in the first line takes O(|S|) time. Moreover, each edge that we examine is added to I and since a vertex can be added to a queue only at the moment its last incoming edge is erased, we do not look at any edge from I multiple times. We also need an analogous function findunreachable-up(G,S) to find a set of vertices that loose connection with the sink after deleting a set of edges. We usually call those two functions together, let us define find-unreachable(G,S) as the union of the results returned by find-unreachable-up(G,S) and findunreachable-down(G,S). 2.3 Updating an SCC Tree After Edge Deletion We maintain an array SCC[v], such that SCC[v] = SCC[w] iff v and w are in the same strongly connected component, which allows us to answer queries in constant time. Initially, because the graph is strongly con-

nected, for each v, SCC[v] points to the root of the SCC tree. As the graph can decompose into smaller SCCs, we will later have a forest of SCC trees, one for each component. After each edge deletion, we update this forest in such a way, that the new forest is an SCC forest for the original graph without the removed edge. 2.3.1 Deleting an Edge from an SCC Tree Root Let us denote by D(X) the DAG from the SCC tree node X and by p(X) the parent node of X. Assume that we are deleting an edge (u, v) from the D(R) = (V, E), whose source is dout , where R is the root node of the SCC tree. Note that in this case, we do not have to pay attention to the fact that each vertex of the DAG D is a contracted set of vertices, since deleting an edge from the root of an SCC tree does not affect these contracted sets. We start by invoking find-unreachable(D(R), {u,v}). Assume that it returns (U, I). Observe that the set U is exactly the set of vertices, that are no longer in the same SCC as d after removing the edge (u, v). Indeed, by the definition of find-unreachable, all vertices from U are either not reachable from dout , or have no connection with din . All other vertices can still be reached from dout and din can still be reached from them. If U is empty, no action should be taken. Otherwise the SCC decomposes into smaller SCCs. When an edge removal causes SCC to decompose, it breaks into smaller SCCs connected by edges into an acyclic graph D0 . Let us describe what it looks like. S The vertex set of D0 is U ∪ { (V \ U )}. Indeed, V , which is a vertex set of D(R), is a partition of S vertices of the original graph, so V is the set of vertices of S the original graph. SThe SCC which used to cover S V now shrinks to (V \ U ) (see Figure 3, where (V \U ) = {1, 7, 8, 9, 10, 11}). Moreover, every element of U is now a separate SCC. The set of edges of D0 can

1441

Copyright © by SIAM. Unauthorized reproduction of this article is prohibited.

be created from the set of edges I, returned by the call to find-unreachable, by replacing S all edges’ endpoints that are not contained in U by (V \ U ). S In this way we obtain D0 = (U ∪ { (V \ U )}, I 0 ), which describes the DAG of SCCs into which an SCC decomposes. In the case of deleting an edge from SCC tree root, we only need to know the vertex set of D0 , as its edges would connect different SCCs in the original graph and are no longer important. However, in the next case, we will need to know its exact structure. The essential fact is that we already have representations of all SCCs that belong to U , since they are represented by the subtrees rooted in the appropriate children of the root node. Hence, we easily obtain a forest of SCC trees for all new SCCs. A special case is when all vertices, except for din and dout , are removed from D(R), which causes d to become a single-vertex SCC. It remains to update the SCC array. For each newly born SCC, we iterate through all its vertices and update the corresponding entries in the SCC array, so that they point to roots of the appropriate SCC trees. 2.3.2 Deleting an Edge from an Internal Node The case when we remove an edge (u, v) from D(N ) = (V, E) where N is an inner node of an SCC tree is only slightly more complex. We already know how to find a DAG D0 of SCCs into which an SCC decomposes after removing an edge. Let us now assume that the SCC represented by the subtree rooted at N decomposes and let w be the vertex in D(p(N )), which corresponds to N. S Since D(N ) = (V, E), w = V . Now S vertex w has to be replaced by the DAG D0 = (U ∪ { (V \ U )}, I 0 ). This operation consists of three steps. First, vertices from U are moved from D(N ) to D(p(N )). At the same time the child nodes of N corresponding to elements of U S are reparented to p(N ). As a result, w represents (V \ U ), as expected (the set of vertices represented by w is defined as the set of leaves in the subtree correspoding to w). Then, edges from I 0 have to be moved from D(N ) to D(p(N )). Note that they should be connected either to w or to some element of U . Finally, we have to correct the edges that were incident to w, so that they point to the proper vertices of the newly inserted DAG. We will later say that we lift up a DAG to refer to this operation. After D0 is lifted up, D(p(N )) can become invalid, namely it might no longer be a single-source and singlesink DAG. Observe that this operation cannot result in a cycle emerging in the DAG. If there was a cycle which contained some edges from outside D0 , then there would also have been a cycle before replacing w by a DAG.

On the other hand, there cannot be any cycles which contain only edges from D0 . Hence, the only problem, which can arise after the substitution, is decomposition of the SCC represented by p(N ) into smaller components. To check if it takes place, we simply call find-unreachable, giving D(p(N )) and all vertices of D0 as its arguments. If it returns a nonempty result, we obtain a DAG of SCCs into which the SCCs represented by p(N ) decomposes. We lift this DAG up to p(p(N )) and continue the process going up the tree as long as necessary. At the end it might turn out that the whole SCC decomposes into smaller components and the SCC array has to be updated. Theorem 2.1. If the depth of an SCC tree is δ and all edges of the graph are eventually deleted, the algorithm processes the updates in O(mδ) total time and answers each query in O(1) time, using O(n + m) space. Proof. By Lemma 2.1 the initialization takes O(mδ) time and the tree uses O(n + m) space. There are two major operations which take place in a loop when an edge is deleted: 1. find-unreachable is called, 2. a DAG D0 is lifted up and a respective vertex is replaced by it, After them the SCC array can possibly be updated. The key observation is that throughout these operations every edge moves up the SCC tree it belongs to. Formally speaking, consider an edge (u, v) of the graph G. It belongs to some DAG D(N ), where N is a node in an SCC tree T . Define the level of (u, v) as the depth of N in T . Similarly, we define the level of a vertex v of G as the depth of the leaf containing v in the SCC tree, which v belongs to. During the course of the algorithm the level of each edge and vertex may only decrease. First, we show that all calls to find-unreachable take O(mδ) time. Recall that the running time of a single find-unreachable operation is linear with respect to the size of its input and output. Every edge it returns is immediately lifted up (the level of the edge decreases) and its second parameter is either of constant size or is a set of vertices that have just been lifted up. It follows that the total running time of find-unreachable is linear in the total number of single edge level decreases, hence it can be bounded by O(mδ). All operations of lifting up DAGs also require O(mδ) time. As S in the previous section, assume that DAG D0 = (U ∪ { (V \ U )}, I 0 ) is lifted up and that it replaces vertex w. This process consists of three steps, we show that each step takes O(mδ) time, as it can be associated with a vertex or an edge which decreases its level.

1442

Copyright © by SIAM. Unauthorized reproduction of this article is prohibited.

1. Vertices from U and their corresponding child nodes are movedSup the SCC tree. Consequently, all vertices from U decrease their S levels (elements of U are nonempty, so |U | ≤ | U |). 2. Edges from I 0 are moved up the SCC tree. The level of each edge decreases. Note that for each edge S endpoint, we have to check whether it belongs to U . If it does not, it has to be connected to w, but this can be done in constant time for each edge. 3. Some edges, which were incident to w, have to be now connected to appropriate elements of U . We iterate through all subtrees corresponding to elements of U to obtain the list of vertices in every element S of U . The total size of those subtrees is O(| U |). Throughout the course of the algorithm each vertex, say v, is inspected this way at most once for each level L (when it decreases its level to L), so the total number of these inspections is S O(nδ). Then for every edge incident to U in the original graph, we can correct it (in constant time), if necessary. Since an edge (u, v) is visited only when the level of u or v decreases, this takes O(mδ) time in total. Updating the SCC[v] array requires O(nδ) time, because every time an SCC tree decomposes into multiple trees, the depth of the leaves in all new trees decreases. With the SCC array, queries can be answered in O(1) time. Corollary 2.1. There exists a deterministic algorithm for decremental maintenance of strongly connected components, which runs in O(mn) total time and answers queries in O(1) time, using O(n + m) space. 3 Decremental Transitive Closure We will use the techniques developed in the previous section to describe a decremental algorithm for maintaining the transitive closure. One approach is to follow the method by Roditty and Zwick [1]. They take an algorithm by Frigioni et al. [2] and replace the part responsible for detecting SCCs decompositions with their decremental randomized algorithm. Then, they observe that Frigioni et al. algorithm runs in O(mn) total time, if the time needed to maintain the structure of SCCs is excluded. This way, they obtain an O(mn) total time randomized algorithm for decremental transitive closure. However, using results from the previous section, we might easily describe a similar algorithm without the need to refer to previous work. First we observe,

that using the procedure find-unreachable-down, we may easily get an O(m) total time algorithm for decremental maintenance of the set of vertices reachable from a given vertex v in a DAG. First, we remove all vertices that are not reachable from v. Then, after an edge connecting two reachable vertices is deleted, find-unreachable-down is called and the vertices that became unreachable are found. It easily follows that the total time of this algorithm is O(m). This can be extended to an O(mn) algorithm for the transitive closure of a DAG, if we run one copy of the above algorithm for each vertex of the graph. To get an algorithm for general digraphs, we first find SCCs of the graph and build an SCC tree for each of them. Then all SCCs are contracted to single vertices, which creates a DAG. The structure of each SCC is maintained by the algorithm from the previous section and the transitive closure of the DAG is handled by the algorithm, which we have just described. To check if there is a path from u to v, we check if they belong to the same SCC or if there is a path between the SCCs to which they belong. The only situation that requires more attention is a decomposition of an SCC. Again, this is similar to a situation from the algorithm for maintaining the SCCs. We need to alter the DAG of SCCs. In every instance of the algorithm, the vertex corresponding to the decomposing SCC has to be replaced by a DAG. No cycle can emerge after this substitution. Therefore, it is sufficient to call find-unreachable-down with the inserted DAG as parameter to find the set of vertices that became unreachable. Since maintaining SCCs as well as the transitive closure of the top-level DAG takes O(mn) time, we obtain a deterministic decremental algorithm for maintaining transitive closure in general digraphs, which requires O(mn) total time and space. 4 Applications to Special Classes of Graphs In this section, we present how to speed up the decremental algorithm from section 2. Until now, while building an SCC tree for a given graph, in each step we selected an arbitrary vertex to be split. We will show, that in some graphs, we may obtain an SCC tree of lower depth if this vertex is chosen in a more careful way. To do that, we will utilize separators. Definition 1. An α-vertex separator of an undirected graph G = (V, E) is a subset of vertices, whose removal decomposes the graph into components of size at most α|V |. The input for an algorithm which maintains SCCs is a directed graph. The theorems for undirected graphs

1443

Copyright © by SIAM. Unauthorized reproduction of this article is prohibited.

are often applied to digraphs throughout this section. In such cases, we actually treat all edges of the graph as undirected. Firstly, we will focus on planar graphs, which, according to a theorem by Lipton and Tarjan, have small separators.

Definition 2. A tree decomposition of an undirected graph G = (V, E) is a pair (X, T ), where X = {Xi | i ∈ I} is a family of subsets of V (called bags) and T = (I, F ) is a tree, such that: S 1. i∈I Xi = V (bags cover vertices of G).

Theorem 4.1. ([13]) Let G = (V, E) be an undirected planar graph. There exists a 32 -vertex separator of G, √ whose size is O( n). It can be found in O(|V |) time.

2. For all (u, v) ∈ E there exists Xi such that u, v ∈ Xi (bags cover edges of G).

The following lemma shows how to take advantage of small vertex separators. Lemma 4.1. Let G = (V, E) be a directed strongly connected graph. Assume that for every subgraph of G induced by U ⊆ V we can find in linear time a K-vertex separator of size O(|U |s ) for s ≥ 0. Then we can build Pdlog |V |e si an SCC tree for G of depth O(|V |s i=0 K ) in Pdlog |V |e si O(|E||V |s i=0 K ) time.

3. For all v ∈ V , Tv = {i ∈ I | v ∈ Xi } forms a connected subtree of T . The width of a decomposition ({Xi | i ∈ I}, T ) is maxi∈I |Xi | − 1. The treewidth of G is the minimum width over all tree decompositions of G. The graphs with bounded treewidth can be efficiently recognized.

Theorem 4.3. ([10]) For all fixed k ∈ N , there exists Proof. We start building an SCC tree for graph and a linear-time algorithm, that tests whether a given graph select consecutive elements from the separator as the G = (V, E) has treewidth at most k, and if so, outputs vertices to be split. After using all the vertices from the a tree decomposition of G with treewidth at most k. separator, the graph breaks into components of size at The important property of graphs with small most K|V |. Hence, if we denote the depth of an SCC treewidth is the fact that they have small vertex septree for a graph with n vertices by D(n), we get arators, which can be efficiently found.

(4.1)

D(n) = O(1) for n = O(1) D(n) ≤ Cns + D(Kn) Pdlog ne ≤ i=0 1/K C(K i n)s Pdlog ne = O(ns i=0 K si ) ,

Theorem 4.4. ([9]) If treewidth of G = (V, E) is at most k, then G has 12 -vertex separator of size at most k + 1.

Theorem 4.5. ([12]) For any fixed k there exists a linear time algorithm, which, given a graph G with a 2 3 which is the required depth. Every level of an SCC 3 -vertex separator of size at most k, returns 4 -vertex tree can be built in linear time with respect to number separator of G, consisting of not more that k vertices. of edges of the graph, so the whole tree can be built in Pdlog |V |e si As a result, for graphs with bounded treewidth, we O(|E||V |s i=0 K ) time. can find a constant size vertex separator in linear time Theorem 4.2. Let G = (V, E) be a directed planar with respect to the graph size. Using this lemma, we graph and |V | = n. There exists a decremental al- obtain a faster decremental algorithm for maintaining gorithm for maintaining its strongly connected compo- SCCs in graphs with bounded treewidth. nents, which runs in O(n1.5 ) total time. Theorem 4.6. Let G = (V, E) be a directed graph, Proof. First, we find strongly connected components whose treewidth is bounded by a constant k. There exists of G. We can work with each SCC separately, so a decremental deterministic algorithm which maintains we assume that the graph is strongly connected. By its strongly connected components in O(n log n) total theorem 4.1 and lemma 4.1, we can build an SCC time. Pdlog ne √ tree of depth O(n1/2 i=0 ( 32 )i/2 ) = O( n) in Pdlog ne O(nn1/2 i=0 ( 23 )i/2 ) = O(n1.5 ) time. Using Theo- Proof. First, we find strongly connected components of the graph and treat each of them separately. Without rem 2.1 from section 2, we obtain the algorithm. loss of generality, we assume that G is acyclic. It The other important class of graphs with small follows from the definition, that the treewidth of every separators are graphs with bounded treewidth. It is a induced subgraph of G is not greater than k. Using concept introduced by Robertson and Seymour [9]. theorems 4.3, 4.4 and 4.5, for every induced subgraph

1444

Copyright © by SIAM. Unauthorized reproduction of this article is prohibited.

of G we can find a 43 -vertex separator in linear time. The size of this separator is O(ns ), where s = 0. By Lemma 4.1, we can build SCC tree for G of depth Pdlog ne O(ns i=0 ( 43 )si ) = O(log n) in O(n log n) time. We use the well-known fact that in graphs with constant treewidth the number of edges is bounded by O(n) (see e.g. [12]). Using Theorem 2.1, we obtain the algorithm. 5 Conclusion We have presented an O(mn) decremental deterministic algorithm for the transitive closure. It matches the time bound for currently best known decremental deterministic algorithms for all-pairs reachability in DAGs, as well as single-source reachability in general graphs. It remains an open problem, if any of those potentially simpler cases can be solved more efficiently. An interesting question is also whether the structure of SCC tree introduced in this paper can be used for constructing any other dynamic graph algorithms. The main problem regarding decremental maintenance of strongly connected components, which remains open, is whether SCCs can be maintained in o(mn) time. In this paper, we have shown such results for some specific classes of graphs.

[9] N. Robertson and P. D. Seymour, Graph minors II: algorithmic aspects of tree-width, J. Algorithms 7 (1986), pp. 309–322. [10] H. L. Bodlaender, A linear-time algorithm for finding tree-decompositions of small treewidth, SIAM J. Comput 25 (1996), pp. 1305–1317. [11] H. L. Bodlaender, Discovering Treewidth, in SOFSEM 2005, vol. 3381 of LNCS, Springer, 2005. [12] B. Reed, Finding approximate separators and computing tree-width quickly, in STOC, 1992, pp. 221–228. [13] R. J. Lipton and R. E. Tarjan, A separator theorem for planar graphs, SIAM J. Appl. Math. 36 (1979), pp. 177–189. [14] T. H. Cormen, C. E. Leiserson, R. L. Rivest and C. Stein, Introduction to Algorithms, 2nd edition, MIT Press, Boston, 2001.

Acknowledgments I would like to thank Łukasz Bieniasz-Krzywiec, Marek Cygan, Krzysztof Diks, Łukasz Kowalik and Dariusz Leniowski for their help, support and useful remarks. References [1] L. Roditty and U. Zwick, Improved dynamic reachability algorithms for directed graphs SIAM J. Comput., 5 (2008), pp. 1455–1471. [2] D. Frigioni, Ch. D. Zaroliagis, T. Miller and U. Nanni U., An experimental study of dynamic algorithms for transitive closure, ACM J. Exp. Algorithmics, 6 (2001). [3] G. F. Italiano, Finding paths and deleting edges in directed acyclic graphs, Inf. Process. Lett., 28 (1988), pp. 5–11. [4] M. R. Henzinger and V. King, Fully dynamic biconnectivity and transitive closure, in FOCS, 1995, pp. 664– 672. [5] J. A. La Poutr´e and J. van Leeuwen, Maintenance of transitive closure and transitive reduction of graphs, in WG, 1988, pp. 106–120. [6] S. Baswana and R. Hariharan, S. Sen, Improved decremental algorithms for transitive closure and all-pairs shortest paths, J. Algorithms, 62 (2007), pp. 74–92. [7] C. Demetrescu, G. Italiano, Fully dynamic transitive closure: breaking through the O(n2 ) barrier, in FOCS, 2000, pp. 381–389. [8] K. Diks and P. Sankowski, Dynamic plane transitive closure, in ESA, 2007, pp. 594–604.

1445

Copyright © by SIAM. Unauthorized reproduction of this article is prohibited.