Dynamic Graph Algorithms - I

Slides:



Advertisements
Similar presentations
Lower Bounds for Additive Spanners, Emulators, and More David P. Woodruff MIT and Tsinghua University To appear in FOCS, 2006.
Advertisements

Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur.
all-pairs shortest paths in undirected graphs
Augmenting Data Structures Advanced Algorithms & Data Structures Lecture Theme 07 – Part I Prof. Dr. Th. Ottmann Summer Semester 2006.
Comp 122, Spring 2004 Greedy Algorithms. greedy - 2 Lin / Devi Comp 122, Fall 2003 Overview  Like dynamic programming, used to solve optimization problems.
Graphs CSC 220 Data Structure. Introduction One of the Most versatile data structures like trees. Terminology –Nodes in trees are vertices in graphs.
Minimum Spanning Trees Definition Two properties of MST’s Prim and Kruskal’s Algorithm –Proofs of correctness Boruvka’s algorithm Verifying an MST Randomized.
Lectures on Network Flows
I/O-Efficient Batched Union-Find and Its Applications to Terrain Analysis Pankaj K. Agarwal, Lars Arge, Ke Yi Duke University University of Aarhus.
1 Dynamic graph connectivity Holm, Lichtenberg, Thorup (98) (based on Henzinger & King (95))
CSE 780 Algorithms Advanced Algorithms Minimum spanning tree Generic algorithm Kruskal’s algorithm Prim’s algorithm.
3 -1 Chapter 3 The Greedy Method 3 -2 The greedy method Suppose that a problem can be solved by a sequence of decisions. The greedy method has that each.
Lists A list is a finite, ordered sequence of data items. Two Implementations –Arrays –Linked Lists.
1 On Dynamic Shortest Paths Problems Liam Roditty Uri Zwick Tel Aviv University ESA 2004.
Greedy Algorithms Reading Material: Chapter 8 (Except Section 8.5)
Course Review COMP171 Spring Hashing / Slide 2 Elementary Data Structures * Linked lists n Types: singular, doubly, circular n Operations: insert,
Dynamic Sets and Data Structures Over the course of an algorithm’s execution, an algorithm may maintain a dynamic set of objects The algorithm will perform.
Greedy Algorithms Like dynamic programming algorithms, greedy algorithms are usually designed to solve optimization problems Unlike dynamic programming.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 11 Instructor: Paul Beame.
CSE 373, Copyright S. Tanimoto, 2002 Up-trees - 1 Up-Trees Review of the UNION-FIND ADT Straight implementation with Up-Trees Path compression Worst-case.
Dynamic Sets and Data Structures Over the course of an algorithm’s execution, an algorithm may maintain a dynamic set of objects The algorithm will perform.
Improved Randomized Algorithms for Path Problems in Graphs PhD Thesis Surender Baswana Department of Computer Science & Engineering, I.I.T. Delhi Research.
1 Binomial heaps, Fibonacci heaps, and applications.
Design and Analysis of Computer Algorithm September 10, Design and Analysis of Computer Algorithm Lecture 5-2 Pradondet Nilagupta Department of Computer.
9/10/10 A. Smith; based on slides by E. Demaine, C. Leiserson, S. Raskhodnikova, K. Wayne Adam Smith Algorithm Design and Analysis L ECTURE 8 Greedy Graph.
Theory of Computing Lecture 10 MAS 714 Hartmut Klauck.
© The McGraw-Hill Companies, Inc., Chapter 3 The Greedy Method.
Chapter 9 – Graphs A graph G=(V,E) – vertices and edges
I/O-Efficient Graph Algorithms Norbert Zeh Duke University EEF Summer School on Massive Data Sets Århus, Denmark June 26 – July 1, 2002.
2IL05 Data Structures Fall 2007 Lecture 13: Minimum Spanning Trees.
Spring 2015 Lecture 11: Minimum Spanning Trees
0 Course Outline n Introduction and Algorithm Analysis (Ch. 2) n Hash Tables: dictionary data structure (Ch. 5) n Heaps: priority queue data structures.
Near Optimal Streaming algorithms for Graph Spanners Surender Baswana IIT Kanpur.
Path Minima on Dynamic Weighted Trees Pooya Davoodi Aarhus University Aarhus University, November 17, 2010 Joint work with Gerth Stølting Brodal and S.
Spanning Trees CSIT 402 Data Structures II 1. 2 Two Algorithms Prim: (build tree incrementally) – Pick lower cost edge connected to known (incomplete)
An optimal dynamic spanner for points residing in doubling metric spaces Lee-Ad Gottlieb NYU Weizmann Liam Roditty Weizmann.
Disjoint Sets Data Structure. Disjoint Sets Some applications require maintaining a collection of disjoint sets. A Disjoint set S is a collection of sets.
I/O-Efficient Batched Union-Find and Its Applications to Terrain Analysis Pankaj K. Agarwal, Lars Arge, Ke Yi Duke University University of Aarhus.
Data Structures and Algorithms in Parallel Computing Lecture 2.
Minimum Spanning Trees CSE 373 Data Structures Lecture 21.
CSE 421 Algorithms Richard Anderson Winter 2009 Lecture 5.
1 CPSC 320: Intermediate Algorithm Design and Analysis July 14, 2014.
Lecture 12 Algorithm Analysis Arne Kutzner Hanyang University / Seoul Korea.
Algorithm Design and Analysis June 11, Algorithm Design and Analysis Pradondet Nilagupta Department of Computer Engineering This lecture note.
CSE 589 Applied Algorithms Spring 1999 Prim’s Algorithm for MST Load Balance Spanning Tree Hamiltonian Path.
Introduction to Algorithms
Minimum Spanning Trees
Disjoint Sets Data Structure
Binomial heaps, Fibonacci heaps, and applications
Lectures on Network Flows
Lecture 12 Algorithm Analysis
Greedy Algorithms / Minimum Spanning Tree Yin Tat Lee
Chapter 5. Optimal Matchings
Randomized Algorithms CS648
CIS 700: “algorithms for Big Data”
Minimum Spanning Tree.
Greedy Algorithms / Dijkstra’s Algorithm Yin Tat Lee
Randomized Algorithms CS648
CSE 373 Data Structures and Algorithms
Lecture 19-Problem Solving 4 Incremental Method
CSCI B609: “Foundations of Data Science”
Lecture 12 Algorithm Analysis
June 12, 2003 (joint work with Umut Acar, and Guy Blelloch)
Dynamic Graph Algorithms
Algorithms (2IL15) – Lecture 7
Minimum Spanning Trees
Dynamic Graph Algorithms
Introduction to Algorithms: Greedy Algorithms (and Graphs)
Binomial heaps, Fibonacci heaps, and applications
Lecture 12 Algorithm Analysis
Presentation transcript:

Dynamic Graph Algorithms - I Surender Baswana Department of CSE, IIT Kanpur.

About this talk animation 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 animation

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

A dynamic graph algorithm No assumption about the updates. 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,…) u,u,u,u,u,u,u, … The structure has to be maintained in an online manner.

Dynamic graph algorithm 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)

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

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]

A motivating example : Undirected Connectivity Fully Dynamic Algorithms: O( 𝒎 ) update time [Frederickson, 1982] O( 𝒏 ) update time [Eppstein, Galil, Italiano, Nissenzweig 1991] O(polylog n) expected update time, O(log n) query time [King and Henzinger 1995] 4. O(polylog n) update time, O(log n) query time [Holm, Litchenberg, Thorup 1998]

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

Examples of fully dynamic algorithms

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

Fully dynamic algorithms for undirected graphs Min-cut Best static algorithm: O(m polylog n) (Randomized) [Karger, 1996] Fully dynamic algorithm: O( 𝒏 ) update time [Thorup, 2001] Graph spanner Definition: A subgraph which is sparse and yet preserves all-pairs distances approximately. Best static algorithm: O(m) [Halperin, Zwick, 1996] Fully dynamic algorithm: O(polylog n) update time [Baswana, Khurana, and Sarkar, 2008]

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

Dynamic algorithms for directed graphs Transitive Closure Incremental algorithm: O(n) update time [Italiano, 1986] Decremental algorithm: O(n) update time Randomized [Roditty and Zwick, 2002] Deterministic [Lacki, 2011 ] Fully Dynamic algorithm: O( 𝒏 𝟐 ) update time [Roditty, 2003] All-pairs Shortest paths Fully dynamic algorithms: Amortized O( 𝒏 𝟐 ) update time [Demetrescu and Italiano, 2003] Worst case O( 𝒏 𝟐.𝟕𝟓 ) update time [Thorup, 2005]

Data structure for dynamic trees

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

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.

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

Dynamic Trees a j g b f e c d u w v u

Dynamic Trees 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

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)

Dynamic Trees query and updates on trees j g b 5 3 2 17 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 32 f 41 7 e c d -3 u 12 44 67 15 w v u

Dynamic Trees query and updates on trees ReportMin(v) = 12 a j g b 5 3 2 17 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 32 f 41 7 e c d -3 u 12 44 67 15 w v u

Dynamic Trees query and updates on trees ReportMin(v) changes … a j g b 5 3 2 17 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 32 f 41 7 e c d -3 u 12 44 67 1 w v u

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

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

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

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

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

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

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

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

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

Fully dynamic algorithm for connectivity

Fully dynamic randomized algorithm for connectivity with polylogarithmic update time

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

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

Fully dynamic randomized algorithm for connectivity with polylogarithmic update time A Hierarchical algorithm 1 2 3 2 log n

Fully dynamic randomized algorithm for connectivity with O( 𝒎 ) update time A 2-level algorithm 2 1

Decremental O( 𝒎 ) update time algorithm for connectivity 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 T1 and T2. Let µ be the number of non-tree edges incident on T2. Replacement edge can be found in time O(µ log n) time. Random sampling

The role of random sampling Exercise: If none of 2k log n balls is blue, then with probability 1−𝑛 −2 , the fraction of blue balls is less than 1/k. Uniform random sampling with replacement

Handling the deletion of a tree edge 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 ? T2 T1 T

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

Handling the deletion of a tree edge Level 2 Level 1

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

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

Bounding µ2 (number of non-tree edges at level 2) Upon splitting T into T1 and T2, how many edges are passed to level 2 ? ≤ 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑛𝑜𝑛_𝑡𝑟𝑒𝑒 𝑒𝑑𝑔𝑒𝑠 𝑖𝑛𝑐𝑖𝑑𝑒𝑛𝑡 𝑜𝑛 𝑇2 𝑘 charge 𝑑𝑒𝑔⁡(𝑣) 𝑘 to each 𝑣 ϵ T2 Level 2 Level 1 T1 T2

Analysis A vertex v is processed only O(log n) times. Whenever v is processed The processing cost of v is O(deg(v)) The number of edges that move to level 2 is less than 𝑑𝑒𝑔⁡(𝑣) 𝑘 Hence µ2 , the number of edges at level 2 is O( 𝑚 𝑘 log n) Processing cost per update : 𝑚 𝑘 log n + k + O(m) [1−𝑛 −2 ] = O( 𝒎 )

Transforming to fully dynamic environment Add every newly inserted edge to level 2. Periodically rebuild the data structure after every ( 𝒎 ) insertions. Expected amortized time per update : O( 𝒎 𝒍𝒐𝒈 𝒏)

Fully dynamic randomized algorithm for connectivity with polylogarithmic update time A partition of E into 2log n levels : (E1, E2, …) In the beginning, E1 = E and Ei = Ø for all i>1 F1 : spanning forest of E1 Fi : spanning forest of 𝑗=1 𝑖 𝐸𝑗 Fi-1 is subset of Fi for all i>1

Fully dynamic randomized algorithm for connectivity with polylogarithmic update time A Hierarchical algorithm 2 log n 2 2 c 1

Open Problems

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 ?