Title: all-pairs shortest paths in undirected graphs
1all-pairs shortest paths in undirected graphs
approximate
Dynamic
- Liam Roditty Uri ZwickTel Aviv University
2Dynamic Graph Problems
Initialize
Insert
Delete
Query
n - number of verticesm - number of edges
3Shortest Paths Problems
Single-Source Shortest Paths (SSSP)
All-Pairs Shortest Paths (APSP)
Distance Oracles
4Approximate Distance Oracles (TZ01)
n by ndistancematrix
APSPalgorithm
Compact datastructure
mn1/k timen11/k space
O(1) query time stretch 2k-1
Stretch-Space tradeoff is essentially optimal!
5Dynamic Shortest Paths Algorithms
Problem Total update time Amortizedupdate time Querytime Authors
Decremental SSSP O(mn) O(n) O(1) Even-Shiloach 81
Decremental (1?)-approximateAPSP O(mn) O(n) O(1) This talk
Problem Amortizedupdate time Querytime Authors
Fully-dynamic APSP O(n2) O(1) Demetrescu-Italiano 03 (Thorup 04)
Fully-dynamic (1?)- approximate APSP O(m1/2n) O(m1/2) This talk
6Decremental Approximate Distance Oracles
Compact datastructure
mn1/k timen11/k space
O(1) query time stretch 2k-1
Static
mn timemn11/k space
Decremental
dmn1/k timemn11/k space
Decremental(up to distance d)
7Three ingredients
Even-Shiloach 81A decremental algorithm for
maintaining a single-source shortest path tree of
depth d with a total running time of O(dm).
Random Sampling Let P be a set of vertices of
size k.Let S be a random subset of vertices of
size (cn ln n)/k.Then with high probability P?S
? ?.
Thorup-Zwick 01Static approximate distance
oracles.
8Decremental SSSP Even-Shiloach 81
Every edge is only examined onceper level!
Total complexityis O(dm).
9Random Sampling
n
Select each elementindependently with probability
The probability that agiven set of k elementsis
not hit is
10A sequence of Samples
Let Si be a subset obtained by selecting each
vertex with probability (c ln n)/(?2i)
Let pi(v) be the vertex of Si closest to v
If v is contained in a connected component with
at least ?2i vertices, then
d(v,pi(v)) ?2i
?2i
pi(v)
11Maintaining the closest centers
To compute pi(v) for every v
- Add a new source vertex si.
- Connect it to all vertices of Si.
- Maintain a SSSP tree from si.
12Maintaining distances from centers
2i2
From each center of Si maintain a SSSP tree of
depth 2i2
Complexity
13Answering a distance query
pi(u)
v
u
Suppose
Return
14Answering a distance query
pi(u)
v
u
Return
where i is smallest such that v is in the tree of
pi(u), i.e.,
This value of i can be found using binary search.
Query time O(log log n)
Stretch 1?
15Reporting long distances in O(1) time
pr(u)
pr(v)
v
u
Suppose
Let
Return
Maintain a table of all Sr to Sr distances.
Size of table is O(n).
16Reporting short distances in O(1) time
Suppose
Develop a decremental version of the static
approximate distance oracles of TZ.
Takedn1/2k2
dmn1/k timemn11/k spacestretch 2k-1
For distancesup to d
The 3-approximation can be refined into a
(1?)-approximation in O(1) time.
17Approximate Distance Oracles TZ01A hierarchy
of centers
A0?V Ak ?? Ai ?sample(Ai-1,n-1/k)
18Clusters
w
19Bunches (inverse clusters)
20Bunches
p2(v)
v
p1(v)
21Approximate Distance Oracles TZ01The data
structure
- For every vertex v?V
- The centers p1(v), p2(v),, pk-1(v)
- A hash table holding B(v)
- For every w?V, we can check, in constant time,
whether w?B(v), and if so, what is ?(v,w).
22Lemma EB(v) kn1/k
Proof B(v)?Ai is stochastically dominated by a
geometric random variable with parameter pn-1/k.
23Query answering algorithm
Algorithm distk(u,v) w?u , i?0 while
w?B(v) i ?i1 (u,v) ?(v,u) w
?pi(u) return ?(w,u) ?(w,v)
24Query answering algorithm
w3p3(v)?A3
w2p2(u)?A2
w1p1(v)?A1
u
v
25Analysis
wipi(u)?Ai
wi-1pi-1(v)?Ai-1
i?
(i1)?
i?
(i-1)?
v
u
?
26Open problems
- Faster dynamic SSSP algorithm?
- Exact dynamic APSP algorithm?
- Weighted graphs?
- Directed graphs?