dynamic graph algorithms
play

Dynamic Graph Algorithms Giuseppe F. (Pino) Italiano University of - PowerPoint PPT Presentation

Dynamic Graph Algorithms Giuseppe F. (Pino) Italiano University of Rome Tor Vergata giuseppe.italiano@uniroma2.it http://people.uniroma2.it/giuseppe.italiano/ Main Goals Understand whats going on in a rich area (35+ years, still very


  1. Dynamic Graph � Algorithms Giuseppe F. (Pino) Italiano University of Rome Tor Vergata giuseppe.italiano@uniroma2.it http://people.uniroma2.it/giuseppe.italiano/

  2. Main Goals Understand what’s going on in a rich area (35+ years, still very active) Master the main algorithmic ideas, tools and techniques introduced Get involved and contribute to solving some exciting open problems!

  3. Prerequisites Basic data structures: • Binary search trees, linking and cutting trees, union-find, etc… Basic (graph) algorithms: • DFS, BFS, MST, shortest paths, etc… Analysis of algorithms: • worst-case, average, amortized, randomized, etc…

  4. Outline Dynamic Graph Problems – Quick Intro Topic 1. (Undirected Graphs) Dynamic Connectivity & MST Topic 2. (Undirected/Directed Graphs) Dynamic Shortest Paths Topic 3. (Non-dynamic?) 2-Connectivity in Directed Graphs

  5. Theory Theory is when you know something, but it doesn't work .

  6. The real world out there… Practice is when something works, but you don't know why.

  7. Combining Theory and Practice? Practice is when something works, but you don't know why. Theory is when you know something, but it doesn't work.

  8. Combining Theory and Practice? Big challenge: combine theory Practice is when and practice… something works, but you don't know why. Theory is when you know something, but it …i.e., nothing doesn't work. works and you don't know why.

  9. Outline Dynamic Graph Problems – Quick Intro Topic 1. (Undirected Graphs) Dynamic Connectivity & MST Topic 2. (Undirected/Directed Graphs) Dynamic Shortest Paths Topic 3. (Non-dynamic?) 2-Connectivity in Directed Graphs

  10. Dynamic Graphs Graphs subject to update operations Insert(u,v) Typical updates: Delete(u,v) ChangeWeight(u,v,w)

  11. Dynamic Graphs Initialize Insert Delete Query A graph

  12. Dynamic Graph Algorithms The goal of a dynamic graph algorithm is to support query and update operations as fast as possible (usually much faster than recomputing from scratch). G = (V,E) n = |V| Notation: m = |E| We will use also amortized analysis: Total worst-case time over sequence of ops # operations

  13. Dynamic Graphs Partially Dynamic Problems Graphs subject to insertions only ( incremental ), or deletions only ( decremental ), but not both. Fully Dynamic Problems Graphs subject to intermixed sequences of insertions and deletions. Usually much more difficult problems.

  14. Dynamic Graph Problems Support queries about properties on a dynamic graph Dynamic Connectivity (undirected graph G) 
 Connected(): Connected(x,y): Is G connected? Are x and y connected in G? Dynamic Minimum Spanning Tree (undirected graph G) 
 Any property on a MST of G

  15. Dynamic Graph Problems Dynamic Transitive Closure (directed graph G) 
 Reachable(x,y): Is y reachable from x in G? Dynamic All Pairs Shortest Paths 
 Distance(x,y): What is the distance from x to y in G? ShortestPath(x,y): What is the shortest path from x to y in G?

  16. Dynamic Graph Problems Dynamic Min Cut MinCut(): Cut(x,y): Min cut? Are x and y on the same side of a min cut of G? Dynamic Planarity Testing planar(): Is G planar? Dynamic k-connectivity k-connected(): k-connected(x,y): Is G k-connected? Are x and y k-connected?

  17. Dynamic Graph Problems Dynamic (Approximate) Maximum Matching Matching(): Maximum Matching? ApproximateMatching(): Approximate Maximum Matching? ValueofMatching(): Dynamic (Approximate) Minimum Vertex Cover VertexCover(): Approximate Minimum Vertex Cover?

  18. Outline Dynamic Graph Problems – Quick Intro Topic 1. (Undirected Graphs) Dynamic Connectivity & MST Topic 2. (Undirected/Directed Graphs) Dynamic Shortest Paths Topic 3. (Non-dynamic?) 2-Connectivity in Directed Graphs

  19. Fully Dynamic Graph Connectivity Maintain an undirected graph G under an intermixed sequence of operations of the following type: • insert(u,v) : Add a new edge (u,v) • delete(u,v) : Remove edge (u,v) from G (assumes (u,v) in G) • connected(u,v) : Return yes if there is a path between u and v; return no otherwise Subproblem (basic ingredient) in many other problems Minimum spanning trees, 2-connectivity, … Simple problem but lots of interesting ideas! 19

  20. connected(v,w) 20

  21. connected(v,w) 21

  22. connected(v,w) 22

  23. insert(v,w) 23

  24. insert(v,w) 24

  25. delete(v,w) 25

  26. delete(v,w) 26

  27. delete(v,w) 27

  28. delete(v,w) 28

  29. Observation Incremental connectivity: Without deletions, union-find data structures would be just enough 29

  30. Incremental Connectivity Disjoint Set-Union: • makeset(x) : {x} • find(x): returns set containing x • union(x,y): replaces find(x) and find(y) by their union

  31. Incremental Connectivity • insert(x,y) : if find(x) ≠ find(y) then union(x,y) • connected(x,y) : return ( find(x) == find(y) ) (true iff x and y are connected) Amortized cost per operation is O( α (m,n)) (inverse Ackermann)

  32. Observation Incremental connectivity: Without deletions, union-find data structures would be just enough Incremental MST: Without deletions, linking and cutting trees [Sleator & Tarjan 1983] would be just enough. Why? 32

  33. Back to Fully Dynamic Connectivity But simple case first: Graph is a forest 33

  34. Operations we need to do on the forest link(v,w) : Join two trees in the forest by inserting edge (v,w) (assume v and w are in different trees) cut(v,w) : Split a tree by deleting edge (v,w) (assume v and w are adjacent in a tree) findtree(v) : Return the tree containing vertex v in the forest 34

  35. Operations we need to do on the forest link(v,w) : Join two trees in the forest by inserting edge (v,w) (assume v and w are in different trees) cut(v,w) : Split a tree by deleting edge (v,w) (assume v and w are adjacent in a tree) findtree(v) : Return the tree containing vertex v in the forest Can do this in O(log n) per operation in the worst case with several data structures, e.g.: • Sleator & Tarjan dynamic trees [1983], • ET-trees (Euler Tour trees) [Tarjan & Vishkin 1984] We refer to those as dynamic tree data structures 35

  36. ET-trees 36

  37. ET-trees R A B C F G D E Euler tour of a tree 37

  38. ET-trees Euler tour of a tree 38

  39. ET-trees ET-tree is a balanced binary tree over the Euler tour of a tree. Can perform link, cut and findtree in O(log n) 39

  40. Euler tour tree : h d A data structure for g dynamic trees c a b 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 f structure ? c h c g a a b e e b b d e e

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

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

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

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

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

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

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

  48. Euler tour tree : h d A data structure for g T2 dynamic trees T1 c a b e f T1 T2 • Split (T,(e,a)) e-f-e-g-e-h-e b-c-d-c-b-a-b • Merge (T 1 ,T 2 ,(u,v)) • Change-origin (T,x) : change the origin of Euler tour to vertex x. Each operation can be implemented in O(log n) T1 T2 worst-case time

  49. Fully Dynamic Connectivity Get to the real thing: Graph is a graph 49

  50. Reduce the problem to a problem on trees (i.e., maintain a certificate for the property) Maintain a spanning forest of the graph We will have to link trees, cut trees, and determine whether two vertices are in the same tree in this forest 50

  51. But dynamic tree data structures are not enough: we still have a problem with deleting a tree edge 51

  52. 52

  53. 53

  54. How do we find out whether there is a “replacement” edge for the forest or it really got disconnected ? For dynamic MSF it is not enough to find a repacement edge, we need to find the best replacement edge 54

  55. Recap (so far) Tree Edge Non-Tree Edge Insert Link Easy Cut, Delete Easy Replacement? 55

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend