surender baswana department of cse, iit kanpur. surender baswana department of cse, iit kanpur

37
Distance sensitivity oracles Surender Baswana Department of CSE, IIT Kanpur.

Upload: lane-cameron

Post on 31-Mar-2015

230 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

Distance sensitivity oracles

Surender BaswanaDepartment of CSE, IIT Kanpur.

Page 2: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

Shortest paths problem

Definition: Given a graph G=(V,E), w: E R, build a data structure which can report shortest path or distance between any pair of vertices.

P(u,v): shortest path from u to vd(u,v): distance from u to v

Objective: reporting P(u,v) in O(|P(u,v)|) time reporting d(u,v) in O(1) time

Number of edges on P(u,v)

Page 3: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

Versions of the shortest paths problem

Single source shortest paths (SSSP): Space: O(n) Preprocessing time : O(m+n log n) Dijkstra’s algorithm

O(mn) Bellman Ford algorithm

All-pairs shortest paths(APSP): Space: O(n2) Preprocessing time : O(n3) Floyd Warshal algorithm

O(mn+n2log n) Johnson’s algorithm

O(mn+n2loglog n) [Pettie 2004]

Page 4: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

Distance sensitivity oracle

Notations: P(u,v,x): shortest path from u to v in G\{x} d(u,v,x): distance from u to v in in G\{x}

Distance sensitivity oracle:

A compact data structure capable of reporting P(u,v,x) and d(u,v,x) efficiently.

Page 5: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

Motivation

Model of a real life network:• Prone to failure of nodes/links• Failures are rare • Repair mechanism exists usually (failed node/link is up after some time)

Problem formulation:Given a parameter k << n, build a compact data structure which can reportP(u,v,S) for any subset S of at most k vertices/edges.

Natural generalization of shortest paths problem

Page 6: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

Outline of the talk

• Survey of the results on distance sensitivity oracles

• Replacement-paths problem for undirected graphs

• All-pairs distance sensitivity oracle

• Open problems

Page 7: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

RESULTS ON DISTANCE SENSITIVITY ORACLES

Page 8: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

A related problem: replacement paths problem

Problem definition: Given a source s, destination t, compute d(u,v,e) efficiently for each e ϵ P(s,t) .

Trivial algorithm: For every edge e ϵ P(s,t), run Dijkstra’s algorithm from s in G\{e}.

Time complexity: O(mn)

s

t

P(s,t)

Also the best till date

Page 9: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

A related problem: replacement paths problem

Better bounds available for replacement paths problem for

Undirected graphs: Time complexity: O(m+n log n) [Gupta et al. 1989] [Hershberger and Suri, 2001]

Unweighted directed graphs: Time complexity: O(m ) (Randomized MonteCarlo algorithm)

[Roditty and Zwick 2005]

Page 10: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

Single source distance sensitivity oracle

Query: report d(s,v,x) for any v,x ϵ V

Trivial solution: For each xϵ V, store a shortest paths tree in G\{x} Space: ϴ(n2) Preprocessing time: O(mn+n2log n)

Lower bound (even for the replacement paths problem): Space: Ω(m) Preprocessing time: Ω(m) [Hershberger, Suri, Bhosle 2004]

Also the best known

Page 11: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

Single source distance sensitivity oraclefor planar graphs

For a planar graph G=(V,E) on n vertices and a source s, we can build a data structure for reporting d(s,v,x) with parameters:

Space O(n polylog n)Preprocessing time O(n polylog n)Query time O(log n)

[B., Lath, and Mehta SODA2012]

Page 12: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

Single source approximate distance sensitivity oracle

d’(s,v,x) ≤ t d(s,v,x) for all v,x ϵ V

Undirected unweighted graphs stretch: (1+ε) for any ε>0 space: O(n log n)

Undirected weighted graphs stretch: 3 space: O(n log n)

[B. and Khanna 2010]

Page 13: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

All-pairs distance sensitivity oracle

Query: report d(u,v,x) for any u,v,x ϵ V

Trivial solution: For each v,xϵ V, store a shortest paths tree rooted at v in G\{x} Space: ϴ(n3) Preprocessing time: O(mn2+n3log n)

Upper bound: Space: ϴ(n2 log n) [Demetrescu et al. 2008] Preprocessing time: O(mn polylog n) [Bernstein 2009]

Page 14: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

REPLACEMENT PATHS PROBLEM IN UNDIRECTED

GRAPHS

Page 15: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

Replacement paths problem in undirected graphs

Given an undirected graph G=(V,E), source s, destination t, compute d(s,t,e) for each e ϵ P(s,t).

Time complexity: O(m+n log n)

Tools needed :

• Fundamental of shortest paths problem

• Dijkstra’s algorithm

s

t

P(s,t)

Page 16: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

Replacement paths problem in undirected graphs

s

t

Txi

xi+1

ei

Page 17: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

Replacement paths problem in undirected graphs

s

t

xi

xi+1

Ui

Di

How will P(s,t,ei) look like ?

ei

u

Page 18: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

Replacement paths problem in undirected graphs

s

t

xi

xi+1

Ui

Di

ei

u

v

What about P(v,t,e) ?d(s,t,e) = d(s,u) + w(e)+ d(v,t,e)for some edge (u,v)P(v,t,e) = P(v,t) for each v ϵ D

Page 19: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

Replacement paths problem in undirected graphs

• Compute shortest path tree rooted at s• Compute shortest path tree rooted at t• For i=1 to k do ei) = min

Space = O(n)Preprocessing time :

Use heap data structure to compute ei) efficiently

O(m+n log n)

Page 20: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

ALL-PAIRS DISTANCE SENSITIVITY ORACLE

Page 21: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

Range-minima problem

Query: Report_min(A,i,j) : report smallest element from {A[i],…,A[j]}

Aim : To build a compact data structure which can answer Report_min(A,i,j) in O(1) time for any 1 ≤ i < j ≤ n.

3.1 29 99 41.5781 67.4

i j n1

A

Page 22: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

Range-minima problem

Why does O(n2) bound on space appear so hard to break ?

… If we fix the first parameter i, we need Ω(n) space. So for all i, we need Ω(n2) space.

3.1 29 99 41.5781 67.4

1

A

ni

True fact

wrong inference

Page 23: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

Range-minima problem : O(n log n) space

i j

Using collaboration

i n1A

Page 24: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

Range-minima problem : O(n log n) space

2

4

8

2𝑡

1

i n1A

Compute (n × log n) matrix M s.t.M[i,t] = min {A[i],A[i+1],….,A[i + ] }

Page 25: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

Range-minima problem : O(n log n) space

i n1A

j

2𝑘

2𝑘+1

j

Page 26: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

All-pairs distance sensitivity oracleTools and Observations:

Definition: Portion of P(u,v,x) between a and b is called detour associated with P(u,v,x).

u vx

How does P(u,v,x) appear relative to P(u,v) ?

ba

Page 27: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

All-pairs distance sensitivity oracleTools and Observations:

2𝑘

4

21

Page 28: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

All-pairs distance sensitivity oracleTools and Observations:

2𝑘

4

21

x y z

Page 29: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

All-pairs distance sensitivity oracleBuilding it in pieces…

Forward data structure :For the graph G:Each vertex u ϵ V keeps the following information: For each level i ≤ log n, For each vertex x at level , a data structure storing d(u,v,x) for each descendant of x.

Space occupied by Forward data structure per vertex: O(n log n)

Page 30: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

All-pairs distance sensitivity oracleOne more Observation:

Let GR be the graph G after reversing all the edge directions.

Observation:Path P(u,v,x) in G is present, though with direction reversed,as P(v,u,x) in GR.

d(u,v,x) in G is the same as d(v,u,x) in GR

Page 31: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

All-pairs distance sensitivity oracleBuilding it in pieces…

Backward data structure :For the graph GR:Each vertex u ϵ V keeps the following information: For each level i ≤ log n, For each vertex x at level , a data structure storing d(u,v,x) for each descendant of x.

Space occupied by Backward data structure per vertex: O(n log n)

Page 32: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

Exploring ways to compute d(u,v,x) …

u v

2𝑘+1

2𝑘 tt

u’(x) x

If Detour of P(u,v,x) departs after u’(x), then we are done !

What if Detour of P(u,v,x) departs before u’(x)?

v’(x)

Use backward data structure at v to compute d(v,u,x) if possible

What if Detour of P(u,v,x) enters P(u,v) after v’(x)?

Page 33: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

Exploring ways to compute d(u,v,x) …

u vu’(x) v’(x)x

The Detour of P(u,v,x) skips all vertices from P(u,v)lying from level to

2𝑘

2𝑘+1

Page 34: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

All-pairs distance sensitivity oracleBuilding it in pieces…

Middle data structure :For the graph G:Each vertex u ϵ V keeps the following information: For each level i ≤ log n, For each vertex subpath P(x,y)originating at level a data structure storing d(u,v,P) for each descendant v of y.

Space occupied by Middle data structure per vertex: O(n log n)

Total space of data structure: O(n2)

Page 35: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

OPEN PROBLEMS

Page 36: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

Open ProblemsSingle source distance sensitivity oracle:

• (1+ε)-approximation for undirected weighted graphs.

Page 37: Surender Baswana Department of CSE, IIT Kanpur. Surender Baswana Department of CSE, IIT Kanpur

Open ProblemsAll-pairs distance sensitivity oracle:

• Better space-query trade off for planar graphs ?

• Handling multiple failures ?