Fully dynamic all-pairs shortest paths with worst-case update-time - - PowerPoint PPT Presentation

fully dynamic all pairs shortest paths with worst case
SMART_READER_LITE
LIVE PREVIEW

Fully dynamic all-pairs shortest paths with worst-case update-time - - PowerPoint PPT Presentation

Fully dynamic all-pairs shortest paths with worst-case update-time revisited Ittai Abraham 1 Shiri Chechik 2 Sebastian Krinninger 3 1 Hebrew University of Jerusalem 2 Tel-Aviv University 3 Max Planck Institute for Informatics Saarland Informatics


slide-1
SLIDE 1

Fully dynamic all-pairs shortest paths with worst-case update-time revisited

Ittai Abraham1 Shiri Chechik2 Sebastian Krinninger3

1Hebrew University of Jerusalem 2Tel-Aviv University 3Max Planck Institute for Informatics

Saarland Informatics Campus since Jan: University of Vienna

SODA 2017

1 / 14

slide-2
SLIDE 2

Dynamic model

G undergoing updates: Dynamic algorithm

2 / 14

slide-3
SLIDE 3

Dynamic model

G undergoing updates: Dynamic algorithm

2 / 14

slide-4
SLIDE 4

Dynamic model

G undergoing updates: Dynamic algorithm Update

2 / 14

slide-5
SLIDE 5

Dynamic model

G undergoing updates: s t distG(s, t)? Dynamic algorithm Update Query

2 / 14

slide-6
SLIDE 6

Dynamic model

G undergoing updates: s t distG(s, t)? Dynamic algorithm Update update time Query query time

2 / 14

slide-7
SLIDE 7

Dynamic model

G undergoing updates: s t distG(s, t)? Dynamic algorithm Update update time Query query time Here: Small query time O(1) or O(log n)

2 / 14

slide-8
SLIDE 8

Dynamic model

G undergoing updates: s t distG(s, t)? Dynamic algorithm Update update time Query query time Here: Small query time O(1) or O(log n) Goal: Minimize update time T(n)

2 / 14

slide-9
SLIDE 9

Dynamic model

G undergoing updates: s t distG(s, t)? Dynamic algorithm Update update time Query query time Here: Small query time O(1) or O(log n) Goal: Minimize update time T(n) Worst-case: After each update, spend time ≤ T(n)

2 / 14

slide-10
SLIDE 10

Dynamic model

G undergoing updates: s t distG(s, t)? Dynamic algorithm Update update time Query query time Here: Small query time O(1) or O(log n) Goal: Minimize update time T(n) Worst-case: After each update, spend time ≤ T(n) Amortized: For a sequence of k updates, spend time ≤ kT(n)

2 / 14

slide-11
SLIDE 11

Question: Can worst-case bounds match amortized bounds?

3 / 14

slide-12
SLIDE 12

Prior work on dynamic APSP

approx. update time type of graphs reference exact ˜ O(mn) weighted directed

[Dijkstra]

exact ˜ O(n2.5√ W ) weighted directed

[King ’99]

1 + ǫ ˜ O(n2 log W ) weighted directed

[King ’99]

2 + ǫ ˜ O(n2) weighted directed

[King ’99]

exact ˜ O(n2.5√ W ) weighted directed

[Demetrescu/Italiano ’01]

exact ˜ O(n2) weighted directed

[Demetrescu/Italiano ’03]

exact ˜ O(n2.75) (*) weighted directed

[Thorup ’05]

2 + ǫ ˜ O(m log W ) weighted undirected

[Bernstein ’09]

2O(k) ˜ O(√mn1/k) unweighted undirected

[Abr./Chechik/Talwar ’14]

(*) worst case

˜ O: ignores log n-factors n: number of nodes m: number of edges W : largest edge weight

4 / 14

slide-13
SLIDE 13

Our result

Theorem (for this talk)

There is an algorithm for maintaining a distance matrix under insertions and deletions of nodes in unweighted undirected graphs with a worst-case update time of ˜ O(n2.75).

5 / 14

slide-14
SLIDE 14

Our result

Theorem (for this talk)

There is an algorithm for maintaining a distance matrix under insertions and deletions of nodes in unweighted undirected graphs with a worst-case update time of ˜ O(n2.75). Toy example! (O(nω) in unweighted graphs)

5 / 14

slide-15
SLIDE 15

Our result

Theorem (for this talk)

There is an algorithm for maintaining a distance matrix under insertions and deletions of nodes in unweighted undirected graphs with a worst-case update time of ˜ O(n2.75). Toy example! (O(nω) in unweighted graphs) More sophisticated use of our technique: ˜ O(n2.67) in weighted directed graphs (randomized) Improves ˜ O(n2.75) of [Thorup ’05] (Arguably) simpler than [Thorup ’05] (which is a deamortization of [Demetrescu/Italiano ’03])

5 / 14

slide-16
SLIDE 16

Batch deletion problem

Preprocessing phase: Preprocess a graph G in time P(n) Deletion phase: A (single) set D of ≤ ∆ nodes is deleted from the graph Compute APSP in G \ D in time D(n)

6 / 14

slide-17
SLIDE 17

Batch deletion problem

Preprocessing phase: Preprocess a graph G in time P(n) Deletion phase: A (single) set D of ≤ ∆ nodes is deleted from the graph Compute APSP in G \ D in time D(n)

Lemma (Thorup ’05)

If there is a batch deletion APSP algorithm supporting up to ∆ deletions with proprocessing time P(n) and batch deletion time D(n), then there is a fully dynamic APSP algorithm with worst-case update time ˜ O(P(n)/∆ + D(n) + ∆n2).

6 / 14

slide-18
SLIDE 18

Batch deletion problem

Preprocessing phase: Preprocess a graph G in time P(n) Deletion phase: A (single) set D of ≤ ∆ nodes is deleted from the graph Compute APSP in G \ D in time D(n)

Lemma (Thorup ’05)

If there is a batch deletion APSP algorithm supporting up to ∆ deletions with proprocessing time P(n) and batch deletion time D(n), then there is a fully dynamic APSP algorithm with worst-case update time ˜ O(P(n)/∆ + D(n) + ∆n2). Restart batch deletion algorithm periodically, spread out preprocessing time over ∆ updates

6 / 14

slide-19
SLIDE 19

Batch deletion problem

Preprocessing phase: Preprocess a graph G in time P(n) Deletion phase: A (single) set D of ≤ ∆ nodes is deleted from the graph Compute APSP in G \ D in time D(n)

Lemma (Thorup ’05)

If there is a batch deletion APSP algorithm supporting up to ∆ deletions with proprocessing time P(n) and batch deletion time D(n), then there is a fully dynamic APSP algorithm with worst-case update time ˜ O(P(n)/∆ + D(n) + ∆n2). Restart batch deletion algorithm periodically, spread out preprocessing time over ∆ updates Insertions are easy: O(∆n2) (Floyd-Warshall)

6 / 14

slide-20
SLIDE 20

Batch deletion problem

Preprocessing phase: Preprocess a graph G in time P(n) Deletion phase: A (single) set D of ≤ ∆ nodes is deleted from the graph Compute APSP in G \ D in time D(n) Suffices to compute shortest paths consisting of ≤ h nodes

Lemma (Thorup ’05)

If there is a batch deletion APSP algorithm supporting up to ∆ deletions with proprocessing time P(n) and batch deletion time D(n), then there is a fully dynamic APSP algorithm with worst-case update time ˜ O(P(n)/∆ + D(n) + ∆n2 + hn2 + n3/h). Restart batch deletion algorithm periodically, spread out preprocessing time over ∆ updates Insertions are easy: O(∆n2) (Floyd-Warshall) Hitting set of size ˜ O(n/h) for all shortest paths with ≤ h nodes

6 / 14

slide-21
SLIDE 21

Repairing a shortest path tree

s

Given: shortest path tree from s

7 / 14

slide-22
SLIDE 22

Repairing a shortest path tree

s v

Given: shortest path tree from s Node v is deleted Shortest path destroyed only for nodes in subtree of v

7 / 14

slide-23
SLIDE 23

Repairing a shortest path tree

s v

Given: shortest path tree from s Node v is deleted Shortest path destroyed only for nodes in subtree of v Run Dijkstra’s algorithm to reattach these nodes to the tree Charge time O(deg(u)) ≤ O(n) to every node u in subtree of v

7 / 14

slide-24
SLIDE 24

Multiple shortest path trees

Goal: shortest paths from a set of source nodes S

s1 s2 s3 s4 s5

8 / 14

slide-25
SLIDE 25

Multiple shortest path trees

Goal: shortest paths from a set of source nodes S

s1 v s2 v s3 v s4 v s5 v

Deletion of v

8 / 14

slide-26
SLIDE 26

Multiple shortest path trees

Goal: shortest paths from a set of source nodes S

s1 v s2 v s3 v s4 v s5 v

Deletion of v Total work: (number of nodes in subtrees of v) ×n

8 / 14

slide-27
SLIDE 27

Multiple shortest path trees

Goal: shortest paths from a set of source nodes S

s1 v s2 v s3 v s4 v s5 v

Deletion of v Total work: (number of nodes in subtrees of v) ×n Goal: limit sizes of subtrees of each node

8 / 14

slide-28
SLIDE 28

Preprocessing

Construct shortest path tree up to depth h for all sources one by one: G

s1 v u

Count size of subtrees for every node Rule: If number of nodes in subtrees of v exceeds λ: v is added to set of heavy nodes H v is deleted from graph, i.e., not considered in future trees

9 / 14

slide-29
SLIDE 29

Preprocessing

Construct shortest path tree up to depth h for all sources one by one: G G

s1 v u s2 v u

Count size of subtrees for every node Rule: If number of nodes in subtrees of v exceeds λ: v is added to set of heavy nodes H v is deleted from graph, i.e., not considered in future trees

9 / 14

slide-30
SLIDE 30

Preprocessing

Construct shortest path tree up to depth h for all sources one by one: G G G \ {v}

s1 v u s2 v u s3 u

Count size of subtrees for every node Rule: If number of nodes in subtrees of v exceeds λ: v is added to set of heavy nodes H v is deleted from graph, i.e., not considered in future trees

9 / 14

slide-31
SLIDE 31

Preprocessing

Construct shortest path tree up to depth h for all sources one by one: G G G \ {v} G \ {v}

s1 v u s2 v u s3 u s4 u

Count size of subtrees for every node Rule: If number of nodes in subtrees of v exceeds λ: v is added to set of heavy nodes H v is deleted from graph, i.e., not considered in future trees

9 / 14

slide-32
SLIDE 32

Preprocessing

Construct shortest path tree up to depth h for all sources one by one: G G G \ {v} G \ {v} G \ {u, v}

s1 v u s2 v u s3 u s4 u s5

Count size of subtrees for every node Rule: If number of nodes in subtrees of v exceeds λ: v is added to set of heavy nodes H v is deleted from graph, i.e., not considered in future trees

9 / 14

slide-33
SLIDE 33

Preprocessing

Construct shortest path tree up to depth h for all sources one by one: G G G \ {v} G \ {v} G \ {u, v}

s1 v u s2 v u s3 u s4 u s5

Count size of subtrees for every node Rule: If number of nodes in subtrees of v exceeds λ: v is added to set of heavy nodes H v is deleted from graph, i.e., not considered in future trees Observations: All shortest paths not using heavy nodes included in trees Number of heavy nodes: |H| ≤ O(|S|nh λ ) ≤ O(n2h λ ) Preprocessing time: O(|S|n2) ≤ O(n3)

9 / 14

slide-34
SLIDE 34

Computing distances after batch of ∆ deletions

G G G \ {v} G \ {v} G \ {u, v}

s1 v u s2 v u s3 u s4 u s5

1 For all deleted nodes: Reattach children to tree using Dijkstra

Running time: O(∆λn) per deletion

◮ Subtree size at most λ per node ◮ Number of deleted nodes at most ∆

Correct for all shortest paths not containing heavy nodes

10 / 14

slide-35
SLIDE 35

Computing distances after batch of ∆ deletions

G G G \ {v} G \ {v} G \ {u, v}

s1 v u s2 v u s3 u s4 u s5

1 For all deleted nodes: Reattach children to tree using Dijkstra

Running time: O(∆λn) per deletion

◮ Subtree size at most λ per node ◮ Number of deleted nodes at most ∆

Correct for all shortest paths not containing heavy nodes

2 Special treatment of heavy nodes: shortest paths via heavy nodes

Compute min

v∈H(dist(s, v) + dist(v, t)) for all s and t

Time per deletion: O(|H|n2) = O(n4h λ )

10 / 14

slide-36
SLIDE 36

Running time wrapped up

O(∆λn) Repair shortest path trees O(n4h λ ) Shortest paths via heavy nodes

11 / 14

slide-37
SLIDE 37

Running time wrapped up

O(∆λn) Repair shortest path trees O(n4h λ ) Shortest paths via heavy nodes O(n3 ∆ ) Preprocessing of O(n3) spread over ∆ updates

11 / 14

slide-38
SLIDE 38

Running time wrapped up

O(∆λn) Repair shortest path trees O(n4h λ ) Shortest paths via heavy nodes O(n3 ∆ ) Preprocessing of O(n3) spread over ∆ updates O(∆n2) Shortest paths via inserted nodes ˜ O(n2h + n3 h ) Shortest paths of length more than h

11 / 14

slide-39
SLIDE 39

Running time wrapped up

O(∆λn) Repair shortest path trees O(n4h λ ) Shortest paths via heavy nodes O(n3 ∆ ) Preprocessing of O(n3) spread over ∆ updates O(∆n2) Shortest paths via inserted nodes ˜ O(n2h + n3 h ) Shortest paths of length more than h ∆ = n0.25, λ = n1.5, h = n0.25 ⇒ ˜ O(n2.75)

11 / 14

slide-40
SLIDE 40

Improvements

Directed graphs: Two types of shortest path trees: incoming and outgoing

12 / 14

slide-41
SLIDE 41

Improvements

Directed graphs: Two types of shortest path trees: incoming and outgoing Weighted graphs: Requires Bellman-Ford in preprocessing: O(n2h) per node

12 / 14

slide-42
SLIDE 42

Improvements

Directed graphs: Two types of shortest path trees: incoming and outgoing Weighted graphs: Requires Bellman-Ford in preprocessing: O(n2h) per node Increased efficiency: Multiple instances of algorithm to cover all hop ranges (+randomization) Load balancing trick

12 / 14

slide-43
SLIDE 43

Open problems

Is ˜ O(n2.5) the right answer?

13 / 14

slide-44
SLIDE 44

Open problems

Is ˜ O(n2.5) the right answer? Pro: Natural barrier for algorithmic approaches Con: No scheme for a conditional lower bound applies

13 / 14

slide-45
SLIDE 45

Thank you!

14 / 14

slide-46
SLIDE 46

Thank you! Questions?

14 / 14

slide-47
SLIDE 47

Insertions are easy

Inserting a node v: v

1 / 7

slide-48
SLIDE 48

Insertions are easy

Inserting a node v: v Floyd-Warshall algorithm For every node s: dist′(s, v) = min

(u,v)(dist(s, u) + w(u, v))

For every node t: dist′(v, t) = min

(v,u)(w(v, u) + dist(u, t))

For every pair s, t: dist′(s, t) = min(dist(s, t), dist′(s, v) + dist′(v, t)) Time per insertion: O(n2)

1 / 7

slide-49
SLIDE 49

Handling deletions

Principle approach: deletions-only algorithm

2 / 7

slide-50
SLIDE 50

Handling deletions

Principle approach: deletions-only algorithm Preprocessing stage: Prepare data structure for handling a batch of ≤ ∆ deletions After every update:

◮ Group updates since preprocessing into insertions and deletions ◮ Perform ≤ ∆ deletions in data structure from preprocessing ◮ Process ≤ ∆ deletions with Floyd Warshall O(∆n2) 2 / 7

slide-51
SLIDE 51

Handling deletions

Principle approach: deletions-only algorithm Preprocessing stage: Prepare data structure for handling a batch of ≤ ∆ deletions After every update:

◮ Group updates since preprocessing into insertions and deletions ◮ Perform ≤ ∆ deletions in data structure from preprocessing ◮ Process ≤ ∆ deletions with Floyd Warshall O(∆n2)

Standard trick: preprocessing can be spread out over ∆ updates ∆ updates

slide-52
SLIDE 52

Handling deletions

Principle approach: deletions-only algorithm Preprocessing stage: Prepare data structure for handling a batch of ≤ ∆ deletions After every update:

◮ Group updates since preprocessing into insertions and deletions ◮ Perform ≤ ∆ deletions in data structure from preprocessing ◮ Process ≤ ∆ deletions with Floyd Warshall O(∆n2)

Standard trick: preprocessing can be spread out over ∆ updates ∆ updates

2 / 7

slide-53
SLIDE 53

Restricted hop depth

Definition

shortest h-hop path: shortest among all paths with ≤ h edges

3 / 7

slide-54
SLIDE 54

Restricted hop depth

Definition

shortest h-hop path: shortest among all paths with ≤ h edges Suppose shortest h-hop path known for all pairs of nodes ⇒ Can compute all-pairs shortest paths in time O(n3 log n/h):

3 / 7

slide-55
SLIDE 55

Restricted hop depth

Definition

shortest h-hop path: shortest among all paths with ≤ h edges Suppose shortest h-hop path known for all pairs of nodes ⇒ Can compute all-pairs shortest paths in time O(n3 log n/h): Hitting set of size O(n/h) (probabilistic argument)

3 / 7

slide-56
SLIDE 56

Restricted hop depth

Definition

shortest h-hop path: shortest among all paths with ≤ h edges Suppose shortest h-hop path known for all pairs of nodes ⇒ Can compute all-pairs shortest paths in time O(n3 log n/h): Hitting set of size O(n/h) (probabilistic argument) Find hitting set C of size O(n log n/h) in time O(n2h) (greedy)

3 / 7

slide-57
SLIDE 57

Restricted hop depth

Definition

shortest h-hop path: shortest among all paths with ≤ h edges Suppose shortest h-hop path known for all pairs of nodes ⇒ Can compute all-pairs shortest paths in time O(n3 log n/h): Hitting set of size O(n/h) (probabilistic argument) Find hitting set C of size O(n log n/h) in time O(n2h) (greedy) Compute shortest paths from nodes in C: O(n3 log n/h)

3 / 7

slide-58
SLIDE 58

Restricted hop depth

Definition

shortest h-hop path: shortest among all paths with ≤ h edges Suppose shortest h-hop path known for all pairs of nodes ⇒ Can compute all-pairs shortest paths in time O(n3 log n/h): Hitting set of size O(n/h) (probabilistic argument) Find hitting set C of size O(n log n/h) in time O(n2h) (greedy) Compute shortest paths from nodes in C: O(n3 log n/h) For all pairs s, t: dist(s, t) = min(disth(s, t), min

v∈C(dist(s, v) + dist(v, t)))

3 / 7

slide-59
SLIDE 59

Summary

Known techniques allow the following restrictions:

1 Only necessary to maintain shortest h-hop paths up to length

(for some parameter h)

4 / 7

slide-60
SLIDE 60

Summary

Known techniques allow the following restrictions:

1 Only necessary to maintain shortest h-hop paths up to length

(for some parameter h)

2 To obtain a fully dynamic algorithm it is sufficient to design a

deletions-only algorithm that

◮ can handle up to ∆ deletions of nodes with worst-case guarantees ◮ after preprocessing the graph

Restart deletions-only algorithm each ∆ updates

4 / 7

slide-61
SLIDE 61

Barriers

5 / 7

slide-62
SLIDE 62

Combinatorial approach [Thorup ’05, Abraham/Chechik/Krinninger ’17]

The best we can hope for: Preprocessing: O(n3) Spread preprocessing over ∆ updates: O(n3/k) Deal with ≤ ∆ insertions after each update: O(n2k) ⇒ O(n2.5)

6 / 7

slide-63
SLIDE 63

Algebraic approach [Sankowski ’04/’05]

Here: Intuition in DAGs

7 / 7

slide-64
SLIDE 64

Algebraic approach [Sankowski ’04/’05]

Here: Intuition in DAGs Transitive closure: Count number of paths from s to t for all pairs Reachable iff #paths > 0 Perform operations for counting modulo random prime Update time O(n2) Avoids special treatment of insertions

7 / 7

slide-65
SLIDE 65

Algebraic approach [Sankowski ’04/’05]

Here: Intuition in DAGs Transitive closure: Count number of paths from s to t for all pairs Reachable iff #paths > 0 Perform operations for counting modulo random prime Update time O(n2) Avoids special treatment of insertions All-pairs shortest paths (distances): For every 1 ≤ ℓ ≤ h, count #paths of length exactly ℓ Additional trick: fast convolution Update time: ˜ O(n2h). Standard trick for hitting long paths: h = √n ⇒ O(n2.5)

7 / 7