SLIDE 1
Dynamic Graph Algorithms Christian Wulff-Nilsen University of - - PowerPoint PPT Presentation
Dynamic Graph Algorithms Christian Wulff-Nilsen University of - - PowerPoint PPT Presentation
Dynamic Graph Algorithms Christian Wulff-Nilsen University of Copenhagen November 14 , 2019 1 / 21 Graph algorithms and data structures 2 / 21 Graph algorithms and data structures Graphs and graph problems are everywhere: 2 / 21 Graph
SLIDE 2
SLIDE 3
Graph algorithms and data structures
2 / 21
- Graphs and graph problems are everywhere:
SLIDE 4
Graph algorithms and data structures
2 / 21
- Graphs and graph problems are everywhere:
SLIDE 5
Graph algorithms and data structures
2 / 21
- Graphs and graph problems are everywhere:
SLIDE 6
Graph algorithms and data structures
2 / 21
- Graphs and graph problems are everywhere:
- Often, we want to model graphs that change over time
SLIDE 7
Graph algorithms and data structures
2 / 21
- Graphs and graph problems are everywhere:
- Often, we want to model graphs that change over time
- Dynamic algorithms and data structures are tailor-made to
handle changes in very large graphs
SLIDE 8
Graphs
3 / 21
- A graph G is a pair (V, E) where V is the set of vertices and E
is the set of connections between these vertices called edges
SLIDE 9
Graphs
3 / 21
- A graph G is a pair (V, E) where V is the set of vertices and E
is the set of connections between these vertices called edges
- Let m = |E| and n = |V | in the following
SLIDE 10
Graphs
3 / 21
- A graph G is a pair (V, E) where V is the set of vertices and E
is the set of connections between these vertices called edges
- Let m = |E| and n = |V | in the following
- Edges may have weights and may be directed or undirected:
4 4 3 3 3 2 2 3 2 1 3 1 2 1 3 2 1
SLIDE 11
A classical graph problem: minimum spanning forest
4 / 21
- We have near-linear time algorithms (Prim, Kruskal,...) to
compute a minimum spanning forest of a given graph:
3 8 6 2 4 1 4 2 1 5 1 3
SLIDE 12
A classical graph problem: minimum spanning forest
4 / 21
- Maintaining a minimum spanning forest in a dynamic graph:
3 8 6 2 4 1 4 2 1 5 1
SLIDE 13
A classical graph problem: minimum spanning forest
4 / 21
- Maintaining a minimum spanning forest in a dynamic graph:
3 8 6 2 4 1 4 2 1 5 1 3
SLIDE 14
A classical graph problem: minimum spanning forest
4 / 21
- Maintaining a minimum spanning forest in a dynamic graph:
3 8 6 2 4 1 4 2 1 5 1 3
SLIDE 15
A classical graph problem: minimum spanning forest
4 / 21
- Maintaining a minimum spanning forest in a dynamic graph:
3 8 6 2 4 1 4 2 1 5 1 3 7
SLIDE 16
A classical graph problem: minimum spanning forest
4 / 21
- Maintaining a minimum spanning forest in a dynamic graph:
3 8 6 2 4 1 4 2 1 5 1 3 7
SLIDE 17
A classical graph problem: minimum spanning forest
4 / 21
- Maintaining a minimum spanning forest in a dynamic graph:
3 8 6 2 4 1 4 1 5 1 3 7
SLIDE 18
A classical graph problem: minimum spanning forest
4 / 21
- Maintaining a minimum spanning forest in a dynamic graph:
3 8 6 2 4 1 4 1 5 1 3 7
SLIDE 19
A classical graph problem: minimum spanning forest
4 / 21
- Maintaining a minimum spanning forest in a dynamic graph:
3 8 6 2 4 1 4 1 5 1 3 7
- Can we handle each update faster than rebuilding from scratch?
SLIDE 20
Dynamic connectivity
5 / 21
- A data structure for dynamic connectivity should support the
following in a dynamic graph G:
SLIDE 21
Dynamic connectivity
5 / 21
- A data structure for dynamic connectivity should support the
following in a dynamic graph G:
- The insertion/deletion of an edge in G
SLIDE 22
Dynamic connectivity
5 / 21
- A data structure for dynamic connectivity should support the
following in a dynamic graph G:
- The insertion/deletion of an edge in G
- A query for whether two vertices u and v are connected in the
current graph G
SLIDE 23
Dynamic connectivity
5 / 21
- A data structure for dynamic connectivity should support the
following in a dynamic graph G:
- The insertion/deletion of an edge in G
- A query for whether two vertices u and v are connected in the
current graph G
- Example:
SLIDE 24
Dynamic connectivity
5 / 21
- A data structure for dynamic connectivity should support the
following in a dynamic graph G:
- The insertion/deletion of an edge in G
- A query for whether two vertices u and v are connected in the
current graph G
- Example:
SLIDE 25
Dynamic connectivity
5 / 21
- A data structure for dynamic connectivity should support the
following in a dynamic graph G:
- The insertion/deletion of an edge in G
- A query for whether two vertices u and v are connected in the
current graph G
- Example:
SLIDE 26
Dynamic connectivity
5 / 21
- A data structure for dynamic connectivity should support the
following in a dynamic graph G:
- The insertion/deletion of an edge in G
- A query for whether two vertices u and v are connected in the
current graph G
- Example:
SLIDE 27
Dynamic connectivity
5 / 21
- A data structure for dynamic connectivity should support the
following in a dynamic graph G:
- The insertion/deletion of an edge in G
- A query for whether two vertices u and v are connected in the
current graph G
- Example:
SLIDE 28
Clusters
6 / 21
SLIDE 29
Cluster forest
7 / 21
SLIDE 30
Handling an update insert(u, v)
8 / 21
SLIDE 31
Handling an update insert(u, v)
8 / 21
SLIDE 32
Handling an update insert(u, v)
8 / 21
SLIDE 33
Handling an update insert(u, v)
8 / 21
SLIDE 34
A vertex of Mi is explored by both search procedures
9 / 21
v u
SLIDE 35
A vertex of Mi is explored by both search procedures
9 / 21
v u
SLIDE 36
A vertex of Mi is explored by both search procedures
9 / 21
v u
SLIDE 37
A vertex of Mi is explored by both search procedures
9 / 21
v u
SLIDE 38
A vertex of Mi is explored by both search procedures
9 / 21
v u
SLIDE 39
A vertex of Mi is explored by both search procedures
9 / 21
v u
SLIDE 40
A vertex of Mi is explored by both search procedures
9 / 21
v u
SLIDE 41
A vertex of Mi is explored by both search procedures
9 / 21
v u
SLIDE 42
A vertex of Mi is explored by both search procedures
9 / 21
v u
SLIDE 43
A vertex of Mi is explored by both search procedures
9 / 21
v u
SLIDE 44
A search procedure has no more edges to explore
10 / 21
v u
SLIDE 45
A search procedure has no more edges to explore
10 / 21
v u
SLIDE 46
A search procedure has no more edges to explore
10 / 21
v u
SLIDE 47
A search procedure has no more edges to explore
10 / 21
v u
SLIDE 48
A search procedure has no more edges to explore
10 / 21
v u
SLIDE 49
A search procedure has no more edges to explore
10 / 21
v u
SLIDE 50
A search procedure has no more edges to explore
10 / 21
v u
SLIDE 51
A search procedure has no more edges to explore
10 / 21
v u
SLIDE 52
A search procedure has no more edges to explore
10 / 21
v u
SLIDE 53
Traversing a single graph edge
11 / 21
SLIDE 54
Spanning tree of a graph
12 / 21
- A spanning tree of a connected undirected graph G is a tree
contained in G which contains all vertices of G:
SLIDE 55
Spanning tree of a graph
12 / 21
- A spanning tree of a connected undirected graph G is a tree
contained in G which contains all vertices of G:
SLIDE 56
Spanning tree of a graph
12 / 21
- A spanning tree of a connected undirected graph G is a tree
contained in G which contains all vertices of G:
SLIDE 57
Spanning forest of a graph
13 / 21
- A spanning forest of a graph G consists of a spanning tree of
each connected component of G:
SLIDE 58
Spanning forest of a graph
13 / 21
- A spanning forest of a graph G consists of a spanning tree of
each connected component of G:
SLIDE 59
Spanning forest of a graph
13 / 21
- A spanning forest of a graph G consists of a spanning tree of
each connected component of G:
SLIDE 60
Spanning forest of a graph
13 / 21
- A spanning forest of a graph G consists of a spanning tree of
each connected component of G:
- If we can efficiently maintain a spanning forest of a dynamic
graph G then we also have an efficient data structure for dynamic connectivity
SLIDE 61
Dynamic Trees
14 / 21
- Suppose we want a data structure maintaining some information
about a dynamic forest where there is no underlying graph:
SLIDE 62
Dynamic Trees
14 / 21
- Suppose we want a data structure maintaining some information
about a dynamic forest where there is no underlying graph:
SLIDE 63
Dynamic Trees
14 / 21
- Suppose we want a data structure maintaining some information
about a dynamic forest where there is no underlying graph:
SLIDE 64
Dynamic Trees
14 / 21
- The data structure should be able to:
SLIDE 65
Dynamic Trees
14 / 21
- The data structure should be able to:
- Insert/delete an edge
SLIDE 66
Dynamic Trees
14 / 21
- The data structure should be able to:
- Insert/delete an edge
- Update the key value of a vertex
SLIDE 67
Dynamic Trees
14 / 21
- The data structure should be able to:
- Insert/delete an edge
- Update the key value of a vertex
- Report the sum or the bitwise AND/OR/XOR of all vertices in
the tree containing a given vertex
SLIDE 68
Dynamic Trees
14 / 21
- The data structure should be able to:
- Insert/delete an edge
- Update the key value of a vertex
- Report the sum or the bitwise AND/OR/XOR of all vertices in
the tree containing a given vertex
000 101 111 110 100 100 010 101
SLIDE 69
Dynamic Trees
14 / 21
- The data structure should be able to:
- Insert/delete an edge
- Update the key value of a vertex
- Report the sum or the bitwise AND/OR/XOR of all vertices in
the tree containing a given vertex
000 101 111 110 100 100 010 101
SLIDE 70
Dynamic Trees
14 / 21
- The data structure should be able to:
- Insert/delete an edge
- Update the key value of a vertex
- Report the sum or the bitwise AND/OR/XOR of all vertices in
the tree containing a given vertex
000 101 111 110 100 100 010 101
SLIDE 71
Dynamic Trees
14 / 21
- The data structure should be able to:
- Insert/delete an edge
- Update the key value of a vertex
- Report the sum or the bitwise AND/OR/XOR of all vertices in
the tree containing a given vertex
000 101 111 110 100 100 010 101
Change to 100
SLIDE 72
Dynamic Trees
14 / 21
- The data structure should be able to:
- Insert/delete an edge
- Update the key value of a vertex
- Report the sum or the bitwise AND/OR/XOR of all vertices in
the tree containing a given vertex
000 101 111 110 100 100 010 100
SLIDE 73
Dynamic Trees
14 / 21
- The data structure should be able to:
- Insert/delete an edge
- Update the key value of a vertex
- Report the sum or the bitwise AND/OR/XOR of all vertices in
the tree containing a given vertex
000 101 111 110 100 100 010 100
Bitwise AND:
SLIDE 74
Dynamic Trees
14 / 21
- The data structure should be able to:
- Insert/delete an edge
- Update the key value of a vertex
- Report the sum or the bitwise AND/OR/XOR of all vertices in
the tree containing a given vertex
000 101 111 110 100 100 010 100
Bitwise AND: 100
SLIDE 75
Dynamic Trees
14 / 21
- The data structure should be able to:
- Insert/delete an edge
- Update the key value of a vertex
- Report the sum or the bitwise AND/OR/XOR of all vertices in
the tree containing a given vertex
000 101 111 110 100 100 010 100
Bitwise AND: 100
- There is a dynamic tree data structure supporting each such
- peration in O(log n) time
SLIDE 76
Fully-dynamic connectivity
15 / 21
- Efficiently maintaining a spanning forest of a graph:
1 2 4 5 6 7 3
SLIDE 77
Fully-dynamic connectivity
15 / 21
- Efficiently maintaining a spanning forest of a graph:
000 001 010 100 101 110 111 011
SLIDE 78
Fully-dynamic connectivity
15 / 21
- Efficiently maintaining a spanning forest of a graph:
000 001 010 100 101 110 111 011 000001 000010 011111 100111 010101 101110 110111 001011 011100 011110
SLIDE 79
Fully-dynamic connectivity
15 / 21
- Efficiently maintaining a spanning forest of a graph:
000001 000010 011111 100111 010101 101110 110111 001011 011110 011100
SLIDE 80
Fully-dynamic connectivity
15 / 21
- Efficiently maintaining a spanning forest of a graph:
001010 010111 111011 010110 000001 000010 011111 100111 010101 101110 110111 001011 011100 011110 000011 111011 000111 001111
SLIDE 81
Fully-dynamic connectivity
15 / 21
- Efficiently maintaining a spanning forest of a graph:
001010 010111 111011 010110 000001 000010 011111 100111 010101 110111 001011 011100 011110 000011 010101 101001 001111
SLIDE 82
Fully-dynamic connectivity
15 / 21
- Efficiently maintaining a spanning forest of a graph:
001010 010111 111011 010110 000001 000010 011111 100111 010101 110111 001011 011100 011110 000011 010101 101001 001111
SLIDE 83
Fully-dynamic connectivity
16 / 21
- The previous only works if there is at most one edge that can
reconnect the tree.
SLIDE 84
Fully-dynamic connectivity
16 / 21
- The previous only works if there is at most one edge that can
reconnect the tree.
- Handling multiple reconnecting edges with random sampling:
1 2 4 5 6 7 3
SLIDE 85
Fully-dynamic connectivity
16 / 21
- The previous only works if there is at most one edge that can
reconnect the tree.
- Handling multiple reconnecting edges with random sampling:
1 2 4 5 6 7 3
SLIDE 86
Dynamic minimum spanning forest
17 / 21
- Suppose that instead of maintaining a spanning forest, we want
to maintain a minimum spanning forest:
3 8 6 2 4 1 4 2 1 5 1
SLIDE 87
Dynamic minimum spanning forest
17 / 21
- Suppose that instead of maintaining a spanning forest, we want
to maintain a minimum spanning forest:
3 8 6 2 4 1 4 2 1 5 1 3
SLIDE 88
Dynamic minimum spanning forest
17 / 21
- Suppose that instead of maintaining a spanning forest, we want
to maintain a minimum spanning forest:
3 8 6 2 4 1 4 2 1 5 1 3
SLIDE 89
Dynamic minimum spanning forest
17 / 21
- Suppose that instead of maintaining a spanning forest, we want
to maintain a minimum spanning forest:
3 8 6 2 4 1 4 2 1 5 1 3 7
SLIDE 90
Dynamic minimum spanning forest
17 / 21
- Suppose that instead of maintaining a spanning forest, we want
to maintain a minimum spanning forest:
3 8 6 2 4 1 4 2 1 5 1 3 7
SLIDE 91
Dynamic minimum spanning forest
17 / 21
- Suppose that instead of maintaining a spanning forest, we want
to maintain a minimum spanning forest:
3 8 6 2 4 1 4 1 5 1 3 7
SLIDE 92
Dynamic minimum spanning forest
17 / 21
- Suppose that instead of maintaining a spanning forest, we want
to maintain a minimum spanning forest:
3 8 6 2 4 1 4 1 5 1 3 7
SLIDE 93
Dynamic minimum spanning forest
17 / 21
- Suppose that instead of maintaining a spanning forest, we want
to maintain a minimum spanning forest:
3 8 6 2 4 1 4 1 5 1 3 7
- Does the XOR trick work here?
SLIDE 94
Types of randomized algorithms
18 / 21
- For several graph problems, state-of-the-art algorithms are
randomized
SLIDE 95
Types of randomized algorithms
18 / 21
- For several graph problems, state-of-the-art algorithms are
randomized
- Some of these algorithms are Las Vegas, some are Monte Carlo.
SLIDE 96
Types of randomized algorithms
18 / 21
- For several graph problems, state-of-the-art algorithms are
randomized
- Some of these algorithms are Las Vegas, some are Monte Carlo.
- Las Vegas algorithm: produces the correct solution but
time/space random
SLIDE 97
Types of randomized algorithms
18 / 21
- For several graph problems, state-of-the-art algorithms are
randomized
- Some of these algorithms are Las Vegas, some are Monte Carlo.
- Las Vegas algorithm: produces the correct solution but
time/space random
- Monte Carlo algorithm: may give incorrect solutions but
time/space typically not random
SLIDE 98
Issues with randomized dynamic graph algorithms
19 / 21
- A randomized dynamic graph algorithm either needs to:
- hide its random bits from the user or
- assume that the user is not adaptive
SLIDE 99
Issues with randomized algorithms
20 / 21
- Concrete example: Randomized approximate shortest path
algorithm supporting:
SLIDE 100
Issues with randomized algorithms
20 / 21
- Concrete example: Randomized approximate shortest path
algorithm supporting:
- Updates: insertion/deletion of a single edge
SLIDE 101
Issues with randomized algorithms
20 / 21
- Concrete example: Randomized approximate shortest path
algorithm supporting:
- Updates: insertion/deletion of a single edge
- Queries: given query vertices u and v, output a value
˜ dG(u, v) such that dG(u, v) ≤ ˜ dG(u, v) ≤ δ · dG(u, v)
SLIDE 102
Issues with randomized algorithms
20 / 21
- Concrete example: Randomized approximate shortest path
algorithm supporting:
- Updates: insertion/deletion of a single edge
- Queries: given query vertices u and v, output a value
˜ dG(u, v) such that dG(u, v) ≤ ˜ dG(u, v) ≤ δ · dG(u, v)
- Suppose a user only has access to the values ˜
dG(u, v) obtained
from queries
SLIDE 103
Issues with randomized algorithms
20 / 21
- Concrete example: Randomized approximate shortest path
algorithm supporting:
- Updates: insertion/deletion of a single edge
- Queries: given query vertices u and v, output a value
˜ dG(u, v) such that dG(u, v) ≤ ˜ dG(u, v) ≤ δ · dG(u, v)
- Suppose a user only has access to the values ˜
dG(u, v) obtained
from queries
- Even this may potentially reveal too much information about the
random bits of the algorithm
SLIDE 104
Oblivious versus adaptive adversary
21 / 21
- Oblivious adversary: entire sequence of updates/queries fixed in
advance
SLIDE 105
Oblivious versus adaptive adversary
21 / 21
- Oblivious adversary: entire sequence of updates/queries fixed in
advance
- Adaptive adversary: the opposite of oblivious adversary
- is allowed to choose subsequent updates/queries based on
the information revealed by the algorithm so far
SLIDE 106
Oblivious versus adaptive adversary
21 / 21
- Oblivious adversary: entire sequence of updates/queries fixed in
advance
- Adaptive adversary: the opposite of oblivious adversary
- is allowed to choose subsequent updates/queries based on
the information revealed by the algorithm so far
- Assuming an oblivious adversary:
- deals with the issue on the previous slides
SLIDE 107
Oblivious versus adaptive adversary
21 / 21
- Oblivious adversary: entire sequence of updates/queries fixed in
advance
- Adaptive adversary: the opposite of oblivious adversary
- is allowed to choose subsequent updates/queries based on
the information revealed by the algorithm so far
- Assuming an oblivious adversary:
- deals with the issue on the previous slides
- but significantly limits the range of applications for the
algorithm
SLIDE 108
Oblivious versus adaptive adversary
21 / 21
- Oblivious adversary: entire sequence of updates/queries fixed in
advance
- Adaptive adversary: the opposite of oblivious adversary
- is allowed to choose subsequent updates/queries based on
the information revealed by the algorithm so far
- Assuming an oblivious adversary:
- deals with the issue on the previous slides
- but significantly limits the range of applications for the
algorithm
- Two ways of allowing an adversary to be adaptive:
SLIDE 109
Oblivious versus adaptive adversary
21 / 21
- Oblivious adversary: entire sequence of updates/queries fixed in
advance
- Adaptive adversary: the opposite of oblivious adversary
- is allowed to choose subsequent updates/queries based on
the information revealed by the algorithm so far
- Assuming an oblivious adversary:
- deals with the issue on the previous slides
- but significantly limits the range of applications for the
algorithm
- Two ways of allowing an adversary to be adaptive:
- develop a deterministic algorithm
SLIDE 110
Oblivious versus adaptive adversary
21 / 21
- Oblivious adversary: entire sequence of updates/queries fixed in
advance
- Adaptive adversary: the opposite of oblivious adversary
- is allowed to choose subsequent updates/queries based on
the information revealed by the algorithm so far
- Assuming an oblivious adversary:
- deals with the issue on the previous slides
- but significantly limits the range of applications for the
algorithm
- Two ways of allowing an adversary to be adaptive:
- develop a deterministic algorithm
- develop a randomized algorithm and prove that it does not