Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 An almost linear fully dynamic reachability algorithm Liam Roditty and Uri Zwick Tel Aviv University.

Similar presentations


Presentation on theme: "1 An almost linear fully dynamic reachability algorithm Liam Roditty and Uri Zwick Tel Aviv University."— Presentation transcript:

1 1 An almost linear fully dynamic reachability algorithm Liam Roditty and Uri Zwick Tel Aviv University

2 2 Fully dynamic reachability The problem: Answer reachability queries on a directed graph that undergoes a sequence of edge insertions and deletions. 12 If only deletions are allowed the algorithm is said to be decremental. 7 6 8 54 9 3 ? Query(7,2) Insertion Center ? Query(8,3)Yes No

3 3 Fully dynamic reachability Approach 1: Maintain explicitly the transitive closure matrix. Query is done in O(1), each update may take  (n 2 ) time.

4 4 Fully dynamic reachability n2n2 Approach 1: Maintain explicitly the transitive closure matrix. Query is done in O(1), each update may take  (n 2 ) time.

5 5 Fully dynamic reachability Open problem: Is it possible to break the  (n 2 ) barrier Our result: Updates in O(m+n log n) and queries in O(n) Approach 2: A data structure which may have a non- constant query time but with smaller update time. Approach 1: Maintain explicitly the transitive closure matrix. Query is done in O(1), each update may take  (n 2 ) time.

6 6 Fully dynamic reachability GraphsAlgorithm Amortized update time QueryAuthor GeneralDeterministicn2n2 1 Demetrescu, Italiano ’00 Roditty ’03 DAGsMonte-Carlon 1.58 n 0.58 Demetrescu, Italiano ’00 GeneralMonte-Carlomn 1/2 log 2 n n log n Henzinger King ’95 GeneralDeterministicmn 1/2 n 1/2 Roditty Zwick ’02 GeneralDeterministicm + n log nn Today

7 7 v3v3 Insert( E w ) : Create two trees to capture new paths An overview of the algorithm Insert( E w ) – Insert the edges E w all touching w into the graph Delete( E’ ) – Delete all edges of E’ from the graph Query( u,v ) – Check whether there is a directed path from u to v … Query( u,v ):  w, u  T in (w)  v  T out (w) Delete( E’ ): Delete E’ from all trees O ( n ) O ( m+n log n ) Once created a graph can only lose edges ! Our goal is to delete edges efficiently u v G 1 (V,E 1 =E v 1 ) O ( m+n log n ) T in (w) T out (w) w vtvt G 2 (V,E 2 =E 1  E v 2 )G 3 (V,E 3 =E 2  E v 3 )G t (V,E t =E t-1  E v t ) Insert( E v 1 ) v1v1 Insert( E v 2 ) v2v2 Insert( E v 3 )Insert( E v t )

8 8 Every edge is only examined once thus the total time is O(m). Decremental reachability tree v Suppose that the graph is DAG (Italiano `88), T in (w) T out (w) w 

9 9 … vtvt v1v1 v2v2 Maintain the components of a sequence of graphs Keep the rule that each edge is scanned only once Build the new component data after each decomposition. For general graphs the cost for a single decremental reachability tree is O(mn)! We reduce the cost to O(m+n logn) for a tree in a forest of trees! G 1 (V,E 1 )G 2 (V,E 2 )G t (V,E t )

10 10 By combining this two ingredients we obtain an efficient maintenance of the forest of reachability trees. An overview of the algorithm Fully dynamic reachability Fully dynamic strong connectivity with “persistency” Decremental reachability tree n Maintain the components of a sequence of graphs Keep the rule that each edge is scanned only once Build the new component data after each decomposition.

11 11 Supported operations: G 0 =(V,E 0 ) Insert(E’) Fully dynamic strong connectivity G 0 =(V,E 0 ) G 1 =(V,E 0  E’) G 1 =(V,E 1 ) Insert(E’’) G 1 =(V,E 1 ) G 2 =(V,E 1  E’’) G 2 =(V,E 2 ) Delete( E’ ) – Delete the set E’ from all versions. Query( u,v,i ) – Are u and v in the same component in G i Insert( E’ ) – Create a new version and add E’ to it. Note that these operations create a graph sequence G 0 (V,E 0 ), G 1 (V,E 1 ), …, G t (V,E t ) where E 0  E 1 …  E t. This containment is kept during all the update operations! O ( m  ( m,n )) O ( 1 )

12 12 Fully dynamic strong connectivity The components of all the graphs in the sequence are arranged in a hierarchy and can be represented as a forest of size O ( n ) G0G0 G1G1 G2G2 G3G3 The components:The forest: G0G0 G1G1 G2G2 G3G3 1 1 1 2 3 u v Query(u,v,1)  Version( LCA(u,v) )  1 Query(u,v,2)  Version( LCA(u,v) )  2 Version tag

13 13 A new partitioning of the edges E 1,…, E t Definition 1: Dynamic edge partitioning H i = { (u,v)  E i | Query(u,v,i)  (  Query(u,v,i-1)  (u,v)  E i-1 ) } H t+1 = E t \  H i i=1 t G i-1 =(V,E i-1 ) G i =(V,E i ) HiHi G i+1 =(V,E i+1 ) H i+1 H i  H j = ø, E t =  H i i=1 t+1

14 14 G0G0 G1G1 G2G2 G3G3 FindScc(H 1,1)FindScc(H 2,2) Shift(H 1,H 2 ) Shift(H 2,H 3 ) FindScc(H 3,3) Shift(H 3,H 4 ) Cost Analysis: Note that an edge enters and leave H i just once Moving edges – Paid by the creation of the version they enter. Free Fixed edges – Paid by the current delete operation O(m) Processing a deletion H i edges

15 15 G0G0 G1G1 G2G2 G3G3 The component forest

16 16 Fully dynamic strong connectivity Summing up, The update time is O ( m  ( m,n )) and the query time is O ( 1 ). The vertices of any component can be listed in time proportional to the size of the component. Given two component forests of before and after a deletion it is possible to find all the decomposed components. The size of the data structure is O(m+n)

17 17 Decremental reachability tree When a decomposition is reported : Build the active vertices list for the new components Connect the new components to the tree Active vertices list Tree edge

18 18 Decremental reachability tree There may be O(n) decompositions in a single tree. Thus, even scanning the decomposed component vertices in order to build the active vertices list for the new components is too much. The total cost may be O(n 2 ). We succeeded to reduce this cost to O(n log n) !

19 19 The total connection cost is O(m) The total decomposition cost is O(n log n) For the whole forest the components are maintained in O(m  (m,n)) for each update Summing up, for each tree Each update costs O(m + n log n) Decremental reachability tree

20 20 Open problems Reduce the query time to m/n ? Reduce the update time to O(m+n) ? Design other fully dynamic algorithm for a graph sequence ? A single decremental reachability tree in general graph in o(mn) ?


Download ppt "1 An almost linear fully dynamic reachability algorithm Liam Roditty and Uri Zwick Tel Aviv University."

Similar presentations


Ads by Google