Top Banner
1 Directed Graphs: Victoria Road Problem
36

1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

Dec 18, 2015

Download

Documents

Brook Bennett
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

1

Directed Graphs:Victoria Road Problem

Page 2: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

2

Update: Edge is deleted; Edge is inserted Edge weight is changed

F

A

Directed graph problems

Page 3: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

3

;

F

A

Directed graph problems

Reachability (transitive closure) Query: Is there a directed path from A to F?

Page 4: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

4

F

A

Directed graph problems

What is (approx.) distance from A to F? orUpdate: Change edges incident to a single node.

Page 5: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

5

Reachability (transitive closure) Query: Is there a directed path from A to F?

All Pairs Shortest PathsQuery: What is (approx.) distance from A to F? orQuery: What is the shortest path from A to F?Update: Change edges incident to a single node.

Strongly Connected ComponentsQuery: Are a and b in the same strongly connected component? (Is there a path from a->b and b->a?)

1997—Now : many papers

Page 6: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

6

GOALS

Reachability (transitive closure) Static cost=O(mn) or fast matrix mult.

All Pairs (approx.) Shortest Paths Static cost = Õ(mn )

Strongly Connected ComponentsStatic cost = O(m)

Decremental/Fully dynamic

Query/Update time tradeoffs

Page 7: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

Kinds of results:1. Counting

2. Decremental single source search (E-S trees, Italano’s reachability trees)

3. Random nodes & Stitching4. Matrix methods5. Strongly Conn.Comps.6. Zombies (historical local paths) Not

Simple7. Hop distances and Shortcut edges

7

Simplest!

Page 8: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

8

COUNTING: Simple monte carlo method for acyclic graph (K, Sagert 1998)

C

J

I

D

For each pair I, J, keep count of #Paths ( I --> J)

Adding (C,D) adds #Paths(I-->C)*#Paths(D-->J)

Subtracting “ subtracts “

Page 9: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

9

But exponentially many!, too large a wordsize so....

C

J

I

D

For each pair I, J, keep count of #Paths ( I --> J) mod p

Adding (C,D) adds #Paths(I-->C)*#Paths(D-->J)

Subtracting “ subtracts “

Pick a Random prime

Page 10: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

10

Works with high probability

Error occurs when #paths = 0 mod p when #paths

Where p[0,…,],

has < clog n prime factors, and there are

~log n prime numbers

so odds of error ~c/ for one path,

And c/for all pairs over

Page 11: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

11

IDEA 2: Using Even-Shiloach Breadthfirst Trees

D

B CA

Recall: O(md) time to maintain deletions only tree to depth dIdea: DON’T go all the way to depth n

Page 12: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

12

Idea #3: Long paths contain random nodes

If every node is chosen with probability 1/d,

then a path of length d it doesn’t have one is

If prob. Increased to

updates =

Page 13: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

Ideas 2&3: Use short trees to deal with short paths/random nodes to deal with long paths (deletions only)Henzinger, K (FOCS 1995), others

13

For i=1 to log n

Form Randomly pick nodes with prob /

For each node x and maintain trees of depth

Page 14: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

14

Forest of Out Trees (E-S Trees) of depth for every node to maintain short paths

v1 v2 vn

r1

depth >

For random nodes chosen with

prob c ln n /

I.e., O(n/log n) random nodes chosen

Page 15: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

15

To answer query: u v

check if there’s short path in Out(u)

check for every random r if u and

v

Cost of Query= #random nodes = n/ log n

Total cost of updates= n (m for short trees + (m (n log n/) for longer trees

=

Page 16: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

16

From Decremental algorithms to fully dynamic algorithms with large query times

• Keep deletions-only data structure for old edges.

• Keep track of recently added edges and rebuild single source/sink decremental E-S trees for these.

• If there is a query, test if any of the recently added edges is on a new path that needs to be used.

• Rebuild deletions-only data structure after enough insertions

Page 17: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

Decremental single source Reachability for acyclic graphs (Italiano(1988)

keep a tree of edges to the nodes

The source can reach and

for each node u store its pred.

If an edge {v,w} is deleted, then test if w has a

“hook” to the nodes u can reach. If not, w is not

Reachable. Check its children.

If an edge is considered and found not to be a hook,

It is never a hook for that tree. -> total cost is O(mn)

Page 18: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

Decremental Reachability for acyclic graphs (Italiano(1988)

Page 19: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

19

Speed up decremental transitive closure

by maintaining Strongly Connected Components

(Roditty, Zwick 2002)

(then use acyclic method)

SCC

v Randomly chosen v

Key Idea: As SCC decomposes, random node v is likely to be in LARGEST comp.

Page 20: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

20

Only rebuild In-Out trees for smaller comps. Total cost ~ cost of largest tree=O(mn)

Page 21: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

21

Only rebuild In-Out trees for smaller comps. Total cost ~ cost of largest tree=O(mn)

Page 22: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

22

Page 23: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

HINT: set

Page 24: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

Shortest (approx.) paths

Page 25: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

State of Art for Query time O(1) Fully dynamic APSP in general graphs to Demetresco Italiano 2003

Decrementaldirected, unweighted Baswana,et

al2002

25

t

Undirected,unweighted Roditty, Zwick (2004)

(improved 2013 FOS Henzinger,Krinniger,

Nanongkal)

Weighted, directed Bernstein 2013 STOC.

Neg edge wts(Thorup)_

Page 26: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

26

First idea: Maintain paths up to length n1/2

Use nodes in S to join short paths together, O(n2.5log n) (K99)

v1 v2 vn

Page 27: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

Roditty and Zwick (FOCS 2004)

Decremental (1+ ε) Approximate Shortest Paths (unweighted, undirected) with

Small query time and Õ(mn) total time

27

For i=1 to log n,

Form Randomly pick nodes

with probability

Page 28: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

28

For i=1 to log n,

Form E-S tree with new node as source node with edges to the elements of

For each node u in E-S Tree i, maintain

=ancestor in . Total cost = O(mn log n)

Page 29: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

Using Ideas 3&4:

29

For each p in keep E-S tree of depth (x’s E-S tree to depth i)

Total cost is (n=O(mn/

For each node u in E-S Tree i, maintain

=ancestor in

Page 30: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

To answer a query what is the approx. distance from (u,v)?

30

Find smallest i such that and Cost=O(log n)

Return dist from to u + dist from

Page 31: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

Why does this work?

31

Return dist from to + dist from

(u) is within of u and

v is within d(u,v) +

d(u,v) or we would have chosen a smaller i

-> returned distance is within (1+2 ε) of d(u,v)

Page 32: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

32

E-S Trees with pos integer weighted edges , weight increases (k 1999)

D

B CA

Similar to Dijkstra’s shortest path alg

Page 33: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

Idea 7: Shortcut edges + hop trees E-S + random nodes (Bernstein, 2013)

Page 34: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

Idea 7: Shortcut edges + hop trees E-S + random nodes (Bernstein, 2013)

Page 35: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

Idea 7: Shortcut edges + hop trees E-S + random nodes

Page 36: 1 Directed Graphs: Victoria Road Problem. 2 Update: Edge is deleted; Edge is inserted Edge weight is changed F A Directed graph problems.

Shortcut edges

Maintain h.SSSP for random sample of nodes

Add shortcut edge (a,b) for all a,b in Sample.

weighted by dist (a,b)

For each sample node run h.SSSP

For every node v

add shortcut edge to each sample node & maintain h. SSSP