Dynamic Graph Algorithms Christian Wulff-Nilsen University of - - PowerPoint PPT Presentation

dynamic graph algorithms
SMART_READER_LITE
LIVE PREVIEW

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-1
SLIDE 1

1 / 21

Dynamic Graph Algorithms

Christian Wulff-Nilsen University of Copenhagen

November 14, 2019

slide-2
SLIDE 2

Graph algorithms and data structures

2 / 21

slide-3
SLIDE 3

Graph algorithms and data structures

2 / 21

  • Graphs and graph problems are everywhere:
slide-4
SLIDE 4

Graph algorithms and data structures

2 / 21

  • Graphs and graph problems are everywhere:
slide-5
SLIDE 5

Graph algorithms and data structures

2 / 21

  • Graphs and graph problems are everywhere:
slide-6
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
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
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
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
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
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
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
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
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
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
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
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
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
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
SLIDE 20

Dynamic connectivity

5 / 21

  • A data structure for dynamic connectivity should support the

following in a dynamic graph G:

slide-21
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
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
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
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
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
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
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
SLIDE 28

Clusters

6 / 21

slide-29
SLIDE 29

Cluster forest

7 / 21

slide-30
SLIDE 30

Handling an update insert(u, v)

8 / 21

slide-31
SLIDE 31

Handling an update insert(u, v)

8 / 21

slide-32
SLIDE 32

Handling an update insert(u, v)

8 / 21

slide-33
SLIDE 33

Handling an update insert(u, v)

8 / 21

slide-34
SLIDE 34

A vertex of Mi is explored by both search procedures

9 / 21

v u

slide-35
SLIDE 35

A vertex of Mi is explored by both search procedures

9 / 21

v u

slide-36
SLIDE 36

A vertex of Mi is explored by both search procedures

9 / 21

v u

slide-37
SLIDE 37

A vertex of Mi is explored by both search procedures

9 / 21

v u

slide-38
SLIDE 38

A vertex of Mi is explored by both search procedures

9 / 21

v u

slide-39
SLIDE 39

A vertex of Mi is explored by both search procedures

9 / 21

v u

slide-40
SLIDE 40

A vertex of Mi is explored by both search procedures

9 / 21

v u

slide-41
SLIDE 41

A vertex of Mi is explored by both search procedures

9 / 21

v u

slide-42
SLIDE 42

A vertex of Mi is explored by both search procedures

9 / 21

v u

slide-43
SLIDE 43

A vertex of Mi is explored by both search procedures

9 / 21

v u

slide-44
SLIDE 44

A search procedure has no more edges to explore

10 / 21

v u

slide-45
SLIDE 45

A search procedure has no more edges to explore

10 / 21

v u

slide-46
SLIDE 46

A search procedure has no more edges to explore

10 / 21

v u

slide-47
SLIDE 47

A search procedure has no more edges to explore

10 / 21

v u

slide-48
SLIDE 48

A search procedure has no more edges to explore

10 / 21

v u

slide-49
SLIDE 49

A search procedure has no more edges to explore

10 / 21

v u

slide-50
SLIDE 50

A search procedure has no more edges to explore

10 / 21

v u

slide-51
SLIDE 51

A search procedure has no more edges to explore

10 / 21

v u

slide-52
SLIDE 52

A search procedure has no more edges to explore

10 / 21

v u

slide-53
SLIDE 53

Traversing a single graph edge

11 / 21

slide-54
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
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
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
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
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
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
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
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
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
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
SLIDE 64

Dynamic Trees

14 / 21

  • The data structure should be able to:
slide-65
SLIDE 65

Dynamic Trees

14 / 21

  • The data structure should be able to:
  • Insert/delete an edge
slide-66
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
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
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
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
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
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
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
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
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
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
SLIDE 76

Fully-dynamic connectivity

15 / 21

  • Efficiently maintaining a spanning forest of a graph:

1 2 4 5 6 7 3

slide-77
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
SLIDE 94

Types of randomized algorithms

18 / 21

  • For several graph problems, state-of-the-art algorithms are

randomized

slide-95
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
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
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
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
SLIDE 99

Issues with randomized algorithms

20 / 21

  • Concrete example: Randomized approximate shortest path

algorithm supporting:

slide-100
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
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
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
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
SLIDE 104

Oblivious versus adaptive adversary

21 / 21

  • Oblivious adversary: entire sequence of updates/queries fixed in

advance

slide-105
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
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
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
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
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
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

reveal (enough) information about its random bits