Download presentation
Presentation is loading. Please wait.
Published byLionel Doyle Modified over 9 years ago
1
Fully Dynamic Transitive Closure: Breaking Through the O(n 2 ) Barrier Camil Demetrescu University of Rome “La Sapienza” Giuseppe F. Italiano University of Rome “Tor Vergata”
2
Fully Dynamic Transitive Closure Given a directed graph G=(V,E), perform any intermixed sequence of the following operations: Insert (x,y):insert edge from x to y in G Delete (x,y):delete edge from x to y in G Query (x,y):is y reachable from x in G?
3
Outline of the Talk State of the art on transitive closure Our results New deterministic algorithm New subquadratic algorithm Directions for further research
4
Static Transitive Closure [Munro 1971] X =X* = AB CD EF GH E = (A+BD*C)* F = EBD* G = D*CE H = D*+D*CEBD* B C DAV1V1 V2V2 V1V1 V2V2 V1V1 V2V2 V1V1 V2V2 V1V1 V2V2
5
Static Transitive Closure [Munro 1971] = exponent for matrix multiplication Best = 2.38 [Coppersmith/Winograd 1990] T(n) ≤ 2 T(n/2) + O(n ) T(n) = O(n )
6
Partially Dynamic: Previous Work Who WhenUpdateQueryAlgorithm Delete only La Poutré van Leeuwen WG ’88 O(m) O(1) Henzinger King FOCS ’95 O(n log 2 n)O(n/log n) Ibaraki Katoh IPL ’83 O(n 2 )O(1) Italiano IPL ’88 O(n) dags O(1) Insert only Ibaraki Katoh IPL ’83 O(n 3 ) on any sequence O(1) Italiano TCS ’86 O(n)O(1) La Poutré van Leeuwen WG ’88 O(n) O(1)
7
Fully Dynamic: Simple-minded Methods Insert/DeleteQueryAlgorithm O(n 2.38 )O(1) Rebuild from scratch transitive closure after each update. 1 O(1) O(n 2 ) Do nothing after each update. Perform visit to answer queries. 2
8
Fully Dynamic: Previous Work Who WhenInsert/DeleteQueryAlgorithm Henzinger King FOCS 1995 O(n 2.16 log 2 n)O(n/log n) Randomized one-side error King Sagert STOC 1999 Randomized one-side error O(n 2.28 ) O(1) King FOCS 1999 Deterministic O(n 2 log n)O(1) Khanna Motwani Wilson SODA 1996 Deterministic + lookahead (n 0.18 ) upd. O(n 2.18 ) O(1)
9
State of the Art O(n 2 ) O(n 2.38 ) O(1) O(n) Query Update O(1)O(n 2 ) SM = Simple-minded KS99 = King/Sagert HK95 = Henzinger/King K99 = King ? ?
10
Breaking Through the O(n 2 ) Barrier O(n) Give up unit-cost queries...
11
Our Results Insert/DeleteQueryAlgorithm O(n 2 )O(1) Deterministic General Digraphs 1 O(n 2-0.62 +n 1+ ) O(n ) Randomized (one-side error) Acyclic Digraphs 2 0 ≤ ≤ 1 We answer positively both questions: O(n)O(1) Deterministic deletion only General Digraphs 3
12
Main Ingredients Introduce a general framework for maintaining dynamic matrices Cast dynamic transitive closure into this framework
13
Deterministic Algorithm: Idea Exploit equivalence: Transitive closure Matrix multiplication Surprisingly, not exploited before in the dynamic setting. Fast matrix multiplication used before only as subroutine.
14
Deterministic: Supported Operations Insert Delete i i i
15
Insert in V 1 : Update E X =X* = AB CD EF GH E = (A+BD*C)* F = EBD* G = D*CE H = D*+D*CEBD* V1V1 V2V2 V1V1 V2V2 V1V1 V2V2 V1V1 V2V2 ABC * E = (A+BD*C)*= D* ?
16
Insert in V 2 : Update E X =X* = AB CD EF GH E = (A+BD*C)* F = EBD* G = D*CE H = D*+D*CEBD* V1V1 V2V2 V1V1 V2V2 V1V1 V2V2 V1V1 V2V2 BCD* * E = (A+BD*C)*= A ?
17
Idea: Work with Two Sets of Relations X = AB CD V1V1 V2V2 V1V1 V2V2 E = (A+BD*C)* F = EBD* G = D*CE H = D*+D*CEBD* Insert in V 1 H = (D+CA*B)* G = HCA* F = A*BH E = A*+A*BHCA* Insert in V 2 X = AB CD V1V1 V2V2 V1V1 V2V2
18
Insert in V 1 : Update F, G and H X =X* = AB CD EF GH E = (A+BD*C)* F = EBD* G = D*CE H = D*+D*CEBD* V1V1 V2V2 V1V1 V2V2 V1V1 V2V2 V1V1 V2V2 How can we update F, G and H? Problem: E == * ?
19
Idea: Exploit Associativity + E=E 2 V2V2 V2V2 V1V1 V1V1 V2V2 V2V2 V1V1 i D*CB EE EBCE EBD*D*C E H D* H =+
20
Our Data Structure for X* X =X* = AB CD EF GH V1V1 V2V2 V1V1 V2V2 V1V1 V2V2 V1V1 V2V2 E 1 = (A+BP 2 C)* F 1 = E 1 2 BP G 1 = PCE 1 2 H 1 = PCE 1 2 BP E 2 = E 1 BH 2 2 CE 1 F 2 = E 1 BH 2 2 G 2 = H 2 2 CE 1 H 2 = (D+CE 1 2 B)* E = E 1 +E 2 G = G 1 +G 2 H = H 1 +H 2 F = F 1 +F 2 P = D*
21
Our Data Structure for X* We represent X* as the sum of two Boolean matrices: X 1 = E1E1 V1V1 V2V2 V1V1 V2V2 F1F1 G1G1 H1H1 X 2 = E2E2 V1V1 V2V2 V1V1 V2V2 F2F2 G2G2 H2H2 Insert on V 1 (resp. V 2 ) Full update of X 1 (resp. X 2 ) Lazy update of X 2 (resp. X 1 ) Neither X 1 nor X 2 encode complete information about X*, but their sum does.
22
Running Times Fully dynamic algorithm for maintaining the transitive closure of a directed graph under insertions of a set of edges with a common endpoint, deletions of any subset of edges, and queries in O(n 2 ) amortized time per update and O(1) time per query. Deletions-only algorithm with O(n) amortized time per deletion and O(1) time per query.
23
Breaking Through the O(n 2 ) Barrier Randomized algorithm (one-side error) on acyclic digraphs O(n 2-0.62 +n 1+ ) O(n ) for any 0 ≤ ≤ 1 Query: Update: for =0.62 O(n 1.62 ) O(n 0.62 ) Query: Update: Our results:
24
Starting Point: King/Sagert [STOC99] C[u,x] C[y,v] C[u,v] C[u,v] + C[u,x] · C[y,v] C[u,v] u xyv Keep a count of the number of distinct paths in acyclic digraphs Problem: counters as large as 2 n Solution: use arithmetic modulo a random prime u,v:
25
Maintaining Dynamic Integer Matrices Given a matrix M of integers, perform any intermixed sequence of the following operations: + · Update (J,I): M M + J · I Query (i,j): return M[i,j]
26
Maintaining Dynamic Integer Matrices Simple-minded method: O(n 2 ) O(1) Query: Update: O(n 2-(3- ) ) O(n ) for any 0 ≤ ≤ 1 Query: Update: = exp. mat. mult. Our result:
27
Maintaining Dynamic Integer Matrices Our data structure: –Lazy approach: buffer at most n updates –Global reconstruction every n updates –Reconstruction done via matrix multiplication
28
Maintaining Dynamic Integer Matrices m M m i1i1 I1I1 j1j1 J1J1 + j 1 · i 1 i2i2 I2I2 j2j2 J2J2 + j 2 · i 2 i3i3 I3I3 j3j3 J3J3 + j 3 · i 3
29
Maintaining Dynamic Integer Matrices i1i1 I1I1 j1j1 J1J1 + j 1 · i 1 i2i2 I2I2 j2j2 J2J2 + j 2 · i 2 i3i3 I3I3 j3j3 J3J3 + j 3 · i 3 m M m · M’ + nn n Global reconstruction every n updates O(n 2-(2- ) )
30
Time Bounds for Transitive Closure O(n 2-0.62 ) O(n ) for any 0 ≤ ≤ 1 Query: Update: +n 1+
31
Directions for Further Research Subquadratic algorithm for general digraphs?Deterministic subquadratic algorithm?Fully Dynamic Shortest Paths?
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.