Dynamic Graph Algorithms Giuseppe F. (Pino) Italiano University of - - PowerPoint PPT Presentation
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
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!
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…
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
Theory is when you know something, but it doesn't work.
Theory
Practice is when something works, but you don't know why.
The real world out there…
Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why.
Combining Theory and Practice?
Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why. Big challenge: combine theory and practice… …i.e., nothing works and you don't know why.
Combining Theory and Practice?
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
Dynamic Graphs
Graphs subject to update operations
Insert(u,v) Delete(u,v) ChangeWeight(u,v,w)
Typical updates:
A graph
Initialize Insert Delete Query
Dynamic Graphs
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). We will use also amortized analysis:
Total worst-case time over sequence of ops # operations
Notation:
G = (V,E) n = |V| m = |E|
Dynamic Graphs
Partially Dynamic Problems
Graphs subject to insertions only (incremental),
- r deletions only (decremental), but not both.
Fully Dynamic Problems
Graphs subject to intermixed sequences
- f insertions and deletions.
Usually much more difficult problems.
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
Dynamic Graph Problems
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? Dynamic Transitive Closure (directed graph G)
Reachable(x,y):
Is y reachable from x in G?
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?
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?
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
- perations 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!
20
connected(v,w)
21
connected(v,w)
22
connected(v,w)
23
insert(v,w)
24
insert(v,w)
25
delete(v,w)
26
delete(v,w)
27
delete(v,w)
28
delete(v,w)
29
Incremental connectivity: Without deletions, union-find data structures would be just enough
Observation
Disjoint Set-Union:
- makeset(x): {x}
- find(x): returns set containing x
- union(x,y): replaces find(x) and find(y) by
their union
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)
Incremental Connectivity
32
Incremental connectivity: Without deletions, union-find data structures would be just enough
Observation
Incremental MST: Without deletions, linking and cutting trees [Sleator & Tarjan 1983] would be just enough. Why?
33
Back to Fully Dynamic Connectivity
But simple case first: Graph is a forest
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
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
36
ET-trees
37
A B D E R G C F
ET-trees
Euler tour of a tree
38
ET-trees
Euler tour of a tree
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)
Euler tour tree :
A data structure for dynamic trees
a b c e f g h d b-c-d-c-b-a- e-f-e-g-e-h-e
- a-b
b d b e e c c a f e g h a e b
How to transform a tree into a one dimensional data structure ?
Euler tour tree :
A data structure for dynamic trees
: minimum value of all
nodes in the subtree.
a b c e f g h d b-c-d-c-b-a- e-f-e-g-e-h-e
- a-b
b d b e e c c a f e g h a e b a f b c d e g h
Euler tour tree :
A data structure for dynamic trees
a b c e f g h d b-c-d-c-b-a- e-f-e-g-e-h-e -a-b
Euler tour tree :
A data structure for dynamic trees
a b c e f g h d b-c-d-c-b-a- e-f-e-g-e-h-e
- a-b
Euler tour tree :
A data structure for dynamic trees
a b c e f g h d a-b b-c-d-c-b-a e-f-e-g-e-h-e T1 T2 T1
Euler tour tree :
A data structure for dynamic trees
a b c e f g h d a-b b-c-d-c-b-a T1 T2 T1 T1 e-f-e-g-e-h-e
Euler tour tree :
A data structure for dynamic trees
a b c e f g h d a-b b-c-d-c-b-a e-f-e-g-e-h-e T1 T2 T1
T1
Euler tour tree :
A data structure for dynamic trees
a b c e f g h d a-b b-c-d-c-b-a e-f-e-g-e-h-e T1 T2 T1 T1
Euler tour tree :
A data structure for dynamic trees
- Split(T,(e,a))
- Merge(T1,T2,(u,v))
- Change-origin(T,x) :
change the origin of Euler tour to vertex x. Each operation can be implemented in O(log n) worst-case time
a b c e f g h d b-c-d-c-b-a-b e-f-e-g-e-h-e T1 T2 T1 T1 T2 T2
49
Fully Dynamic Connectivity
Get to the real thing: Graph is a graph
50
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 Reduce the problem to a problem on trees (i.e., maintain a certificate for the property)
51
But dynamic tree data structures are not enough: we still have a problem with deleting a tree edge
52
53
54
How do we find
- ut 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
55
Recap (so far)
Tree Edge Non-Tree Edge Insert Link Easy Delete Cut, Replacement? Easy
(Main) History of the Problem
Update Query Reference
O(log3 n) [Henzinger, King JACM’99] [Holm, de Lichtenberg & log n log log n O( )
Type
O(m1/2 ) O(1) [Frederickson SICOMP’85] det/w-c O(n1/2 ) O(1) [Eppstein, Galil, I. & det/w-c rand/amort O(log2 n) [Henzinger, Thorup log n log log n O( ) rand/amort O(log2 n) log n log log n O( ) det/amort O(log n (log log n)) log n log log log n O( ) rand/amort [Thorup STOC’00] [Wulff-Nilsen SODA’13] log n log log n O( ) log2 n log log n O( ) det/amort O(log5 n) [Kapron, King & O( ) rand/w-c log n log log n Nissenzweig JACM’97]
- Rand. Struct. & Algs. ’97]
Thorup JACM’01] Mountjoy SODA’13]
Very Recent Results
Update Query Reference Type
n log n O( ( )½ log log n ) O(log4 n) [Gibb, Kapron, King & O( ) rand/w-c log n log log n Thorn arXiv’15] O(1) [Keilberg-Rasmussen, det/w-c Thorup, arXiv’15] Kopelowitz, Pettie &
Very Recent Results
Update Query Reference Type
n log n O( ( )½ log log n ) O(log4 n) [Gibb, Kapron, King & O( ) rand/w-c log n log log n Thorn arXiv’15] O(1) [Keilberg-Rasmussen, det/w-c Thorup, arXiv’15] Kopelowitz, Pettie &
Questions (Open): For worst-case per operation, can we bridge the gap between randomized (polylog) and deterministic (polynomial)? Or at least get a Las Vegas polylog bound? (I.e., no errors)
Will see
Update Query Reference
O(log3 n) [Henzinger, King JACM’99] [Holm, de Lichtenberg & log n log log n O( )
Type
O(m1/2 ) O(1) [Frederickson SICOMP’85] det/w-c O(n1/2 ) O(1) [Eppstein, Galil, I. & det/w-c rand/amort O(log2 n) [Henzinger, Thorup log n log log n O( ) rand/amort O(log2 n) log n log log n O( ) det/amort O(log n (log log n)) log n log log log n O( ) rand/amort [Thorup STOC’00] [Wulff-Nilsen SODA’13] log n log log n O( ) log2 n log log n O( ) det/amort O(log5 n) [Kapron, King & O( ) rand/w-c log n log log n Nissenzweig JACM’97]
- Rand. Struct. & Algs. ’97]
Thorup JACM’01] Mountjoy SODA’13]
Will actually see
Update Query Reference
O(log3 n) [Henzinger, King JACM’99] [Holm, de Lichtenberg & log n log log n O( )
Type
O(m1/2 ) O(1) Simpler version det/w-c O(n1/2 ) O(1) [Eppstein, Galil, I. & det/w-c rand/amort O(log2 n) [Henzinger, Thorup log n log log n O( ) rand/amort O(log2 n) O(log n) det/amort O(log n (log log n)) log n log log log n O( ) rand/amort [Thorup STOC’00] [Wulff-Nilsen SODA’13] log n log log n O( ) log2 n log log n O( ) det/amort O(log5 n) [Kapron, King & O( ) rand/w-c log n log log n Nissenzweig JACM’97]
- Rand. Struct. & Algs. ’97]
Thorup JACM’01] Mountjoy SODA’13]