Presentation is loading. Please wait.

Presentation is loading. Please wait.

Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur.

Similar presentations


Presentation on theme: "Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur."— Presentation transcript:

1 Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur.

2 About this talk Prerequisite: a course on data structure and algorithms Survey of the results: (not the main objective of the talk) Main contents: -- A novel data structure -- A fully dynamic algorithm for a fundamental graph problem AIM: To give an exposure to the beautiful area of dynamic algorithms

3 A (static) Graph Algorithm Algorithm G=(V,E)Solution

4 A dynamic graph algorithm For problems involving queries (connectivity, distance,…): initial graph G=(V,E) followed by a sequence q,u,u,q,u,u,u,q,u,q,q,u, … q: query u: insertion/deletion of edge Each query has to be answered in an online manner. For problems that aim to maintain some structure (matching, spanner, min-cut,…) initial graph G=(V,E) followed by a sequence u,u,u,u,u,u,u, … The structure has to be maintained in an online manner. No assumption about the updates.

5 Dynamic graph algorithm Aim: Aim: Maintain a data structure which can answer each query efficiently (or maintain the structure), and process each update efficiently ( much faster than the static algo ) Types of dynamic graph algorithms: Incremental (only insertion of edges) Decremental (only deletion of edges) Fully dynamic (both insertion and deletion of edges)

6 A motivating example : Undirected Connectivity u v a a a a b b b b b b c c c c c c d d d d Static solution:

7 A motivating example : Undirected Connectivity Incremental Algorithm: O(log* n) update time ( Disjoint Set Union Algorithm [Tarjan 1975]) Decremental Algorithm: – O(n) update time [Even and Shiloach, 1981] – O(log n) update time [Thorup 1997]

8 A motivating example : Undirected Connectivity

9 Outline of the talk Dynamic graph algorithms for some important problems Data structure for dynamic trees Fully dynamic connectivity with polylog n update time Open problems

10

11 Fully dynamic algorithms for undirected graphs 1. Connectivity 2.2-edge connectivity 3. Bi-connectivity 4. Bipartiteness 5.Min. spanning tree O(polylog n) update time [Holm, Litchenberg, Thorup 1998]

12 Fully dynamic algorithms for undirected graphs

13 Dynamic algorithms for directed graphs Maintaining BFS tree under deletion of edges : O(n) time per edge deletion [Even & Shiloach, 1981] Unbeaten till date. Used in many dynamic algorithms for directed graphs. Not as good bounds as undirected graphs

14 Dynamic algorithms for directed graphs

15

16 Data structures Stacks Queues Binary heap Binary search tree... Fibinaacci heap Too elementary Limited applications Too complex Hardly any application !

17 Power of Data structures: Power of Data structures: An inspirational example Maintain n records r(1),…,r(n) under the following operations Add(i,j,x) : Add x to each record from r(i),…,r(j). All-swap(i,j) : r(i)↔r(j), r(i+1) ↔ r(j-1), r(i+2) ↔ r(j-2). Report(i) : report record r(i). Report-min(i,j) : report the smallest record from r(i),…,r(j). Each operation in O(log n) worst case time.

18 Balanced Binary Tree : a very powerful data structure : Additional information

19 Dynamic Trees ef a u c gj d b w v u

20 Aim Aim : Maintain a forest of trees on n vertices under the following operation. Link(u,v) : Add an edge between u and v Cut(u,v) : Delete an edge between u and v Update() : Update information associated with nodes/edges Query() : – Topological – information associated with a tree, or a path

21 Data Structures for Dynamic Trees ST Tree [Sleator & Tarjan, 1983] Operations and queries on edges of paths ET tree [Henzinger and King, 1995] Operations and queries on nodes of a tree Top tree [Alstrup et al., TALG 2005] (generalization of Topology Tree [Frederickson, 1982] ) Topological properties (diameter, center)

22 Dynamic Trees query and updates on trees Operations : Link(u,v) Cut(u,v) Update-weight-node(v,a): weight(v)  a Add-weight-tree(v,x): add x to weight of each node of tree of v ReportMin(u ): report min weight in the entire tree containing u a u c g ef j d b w v u

23 Dynamic Trees query and updates on trees ReportMin(v) = 12 Operations : Link(u,v) Cut(u,v) Update-weight-node(v,a): weight(v)  a Add-weight-tree(v,x): add x to weight of each node of tree of v ReportMin(u ): report min weight in the entire tree containing u a u c g ef j d b w v u

24 Dynamic Trees query and updates on trees ReportMin(v) changes … Operations : Link(u,v) Cut(u,v) Update-weight-node(v,a): weight(v)  a Add-weight-tree(v,x): add x to weight of each node of tree of v ReportMin(u ): report min weight in the entire tree containing u a u c g ef j d b w v u

25 Euler tour tree : A data structure for dynamic trees ab c e f g h d b-c-d-c-b-a-e-f-e-g-e-h-e-a-b bd be e c c a f e g h a e b How to transform a tree into a one dimensional data structure ?

26 Euler tour tree : A data structure for dynamic trees : minimum value of all nodes in the subtree. ab c e f g h d b-c-d-c-b-a-e-f-e-g-e-h-e-a-b bd be e c c a f e g h a e b a f b c d e g h

27 Euler tour tree : A data structure for dynamic trees ab c e f g h d b-c-d-c-b-a- e-f-e-g-e-h-e -a-b

28 Euler tour tree : A data structure for dynamic trees ab c e f g h d b-c-d-c-b-a-e-f-e-g-e-h-e-a-b

29 Euler tour tree : A data structure for dynamic trees ab c e f g h d a-b b-c-d-c-b-a e-f-e-g-e-h-e T1 T2 T1

30 Euler tour tree : A data structure for dynamic trees ab c e f g h d a-b b-c-d-c-b-a T1 T2 T1 e-f-e-g-e-h-e

31 Euler tour tree : A data structure for dynamic trees ab c e f g h d a-b b-c-d-c-b-a e-f-e-g-e-h-e T1 T2 T1

32 Euler tour tree : A data structure for dynamic trees ab c e f g h d a-b b-c-d-c-b-a e-f-e-g-e-h-e T1 T2 T1

33 Euler tour tree : A data structure for dynamic trees Split(T,(e,a)) Merge(T 1,T 2,(u,v)) Change-origin(T,x) : change the origin of Euler tour to vertex x. ab c e f g h d b-c-d-c-b-a-b e-f-e-g-e-h-e T1 T2 T1 T2

34

35 Fully dynamic randomized algorithm for connectivity with polylogarithmic update time

36 Maintain ET tree for each tree in the spanning forest

37 Fully dynamic randomized algorithm for connectivity with polylogarithmic update time Maintain ET tree for each tree in the spanning forest

38 Fully dynamic randomized algorithm for connectivity with polylogarithmic update time A Hierarchical algorithm log n

39 12 A 2-level algorithm

40 Key tools in addition to ET tree data structure: Trivial algorithm (for handling deletion of a tree edge) : Let (u,v) be a tree edge in the spanning forest. Let its deletion creates trees T 1 and T 2. Let µ be the number of non-tree edges incident on T 2. Replacement edge can be found in time O(µ log n) time. Random sampling

41 The role of random sampling Uniform random sampling with replacement

42 Handling the deletion of a tree edge T2 T1 T T2 How to augment ET-tree to sample an edge ? Few samplings needed if the fraction of blue edges is large What if fraction of blue edges is small ?

43 Handling the deletion of a tree edge 2-Level approach A partition of E into two levels : (E 1, E 2 ) In the beginning, E 1 = E and E 1 = Ø F 1 : spanning forest of E 1 F 2 : spanning forest of E, F 1 is subset of F 2 Level 1 Level 2

44 Handling the deletion of a tree edge Level 1 Level 2

45 Handling the deletion of a tree edge Level 1 Level 2 Trivial algorithm at level 2 Random sampling at level 1

46 Algorithm for handling deletion of a tree edge If (e ϵ F 2 \ F 1 ) scan non-tree edges at level 2 to find replacement edge. Else Let T be the tree to which e belongs; (T 1,T 2 )  Split(T,e); Repeat k log n times { (u,v)  Sample-edge(T 2 ); If (u,v) is a cut-edge { add (u,v) to F 1 ; Merge(T 1,T 2, (u,v)); return; } } Scan all non-tree edges incident on T 2 ; If less than 1/k fraction are cut-edges move all edges of cut(T 1,T 2 ) to Level 2 and add one of them to F 2. Else add an edge of cut(T 1,T 2 ) to F 1 O(µ 2 ) time O(k logn) time O(µ 1 (T 2 )) time

47 Bounding Bounding µ 2 (number of non-tree edges at level 2) Level 1 Level 2 T2T1

48 Analysis

49 Transforming to fully dynamic environment

50 Fully dynamic randomized algorithm for connectivity with polylogarithmic update time

51 A Hierarchical algorithm log n c 2

52

53 Open problems Amortized cost versus worst case bounds Specific problems : Min-cut, s-t min cut, max-flow, … Specific graph family : Planar graphs Better lower bounds ?


Download ppt "Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur."

Similar presentations


Ads by Google