Distance sensitivity oracles

```Distance sensitivity oracles
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 v
d(u,v): distance from u to v
Number of edges on P(u,v)
Objective:
reporting P(u,v) in O(|P(u,v)|) time
reporting d(u,v) in O(1) time
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]
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.
Motivation
Natural generalization of
shortest paths problem
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 report
P(u,v,S) for any subset S of at most k vertices/edges.
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
A related problem: replacement paths problem
Problem definition: Given a
s
source s, destination t, compute
d(u,v,e) efficiently for each e ϵ P(s,t) .
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)
t
Also the best till date
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]
Single source distance sensitivity oracle
Query: report d(s,v,x) for any v,x ϵ V
Trivial solution:
Also the best known
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]
Single source distance sensitivity oracle
for 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]
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)
[B. and Khanna 2010]
Undirected weighted graphs
stretch: 3
space: O(n log n)
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]
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).
s
Time complexity: O(m+n log n)
P(s,t)
Tools needed :
t
•
Fundamental of shortest paths problem
•
Dijkstra’s algorithm
Replacement paths problem in undirected
graphs
s
ei
xi
xi+1
t
T
Replacement paths problem in undirected
graphs
s
How will P(s,t,ei)
look like ?
Ui
ei
xi
xi+1
u
t
Di
Replacement paths problem in undirected
graphs
s
d(s,t,e)
d(s,u)P(v,t,e)
+ w(e)+? d(v,t,e)
for=some
(u,v)v ϵ D
P(v,t,e)
P(v,t)edge
for each
Ui
ei
xi
xi+1
u
t
v
Di
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
d(, ,ei) = min d(, ) + d(, ) +  ,
Space = O(n)
Preprocessing time :
ϵ, ϵ
O(m+n log n)
 Use heap data structure to compute d(, ,ei) efficiently
Range-minima problem
Query:
Report_min(A,i,j) : report smallest element from {A[i],…,A[j]}
1
A
3.1
29
i
j
99
781
n
41.5 67.4
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.
Range-minima problem
Why does O(n2) bound on space appear so hard to break ?
1
A
3.1
n
i
29
99
781
… If we fix the first parameter i, we need Ω(n) space.
True fact
So
for all i, we need Ω(n2) space.
wrong inference
41.5 67.4
Range-minima problem : O(n log n) space
Using collaboration
i
j
A
1
i
n
Range-minima problem : O(n log n) space
2
8
4
2
1
A
1
n
i
Compute (n × log n) matrix M s.t.
M[i,t] = min {A[i],A[i+1],….,A[i +  ] }
Range-minima problem : O(n log n) space
2+1
2
A
1
i
j
j −2
n
All-pairs distance sensitivity oracle
Tools and Observations:
u
a
x
b
v
How does P(u,v,x)
appear relative to P(u,v)
Definition: Portion ?of P(u,v,x) between a and b is called detour associated
with P(u,v,x).
All-pairs distance sensitivity oracle
Tools and Observations:
1
2
4
2
All-pairs distance sensitivity oracle
Tools and Observations:
1
2
4
x
y
z
2
All-pairs distance sensitivity oracle
Building 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 2 ,
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)
All-pairs distance sensitivity oracle
One 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
All-pairs distance sensitivity oracle
Building 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 2 ,
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)
Exploring ways to compute d(u,v,x) …
u
x
u’(x)
t
t
2
2+1
If Detour of P(u,v,x) departs after u’(x), then we
are done !
What
if Detour
of
P(u,v,x)
departs
u’(x)?
What
if Detour
of structure
P(u,v,x)
enters
after
Use
backward
data
at v before
toP(u,v)
compute
d(v,u,x) v’(x)?
if possible
v’(x)
v
Exploring ways to compute d(u,v,x) …
u
u’(x)
x
v’(x)
2
2+1
The Detour of P(u,v,x) skips all vertices from P(u,v)
lying from level 2 to 2+1
v
All-pairs distance sensitivity oracle
Building 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 2 and having2 edges,
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)
Open Problems
Single source distance sensitivity oracle:
• (1+ε)-approximation for undirected weighted graphs.
Open Problems
All-pairs distance sensitivity oracle:
• Better space-query trade off for planar graphs ?
• Handling multiple failures ?
```