6.889 — Lecture 12: Exact Distance Oracles
(a.k.a. Shortest-Path
Queries
)
Christian Sommer
csom@mit.edu
(ﬁgures extracted from [
Dji96
,
FR06
])
October 24, 2011
Distance Oracle
: given a graph
G
= (
V,E
)
, preprocess it into a data structure such that we can compute
shortest-path distances
d
G
(
v,w
)
(
distance queries
) efﬁciently (and output path if desired).
two algorithms: one algorithm to
preprocess
the graph, one algorithm to
query
the data structure.
Assumption (all of Lecture 12)
planar
G
, non-negative edge lengths
‘
:
E
→
R
+
Lazy strategy
run SSSP algorithm for every query
d
G
(
v,w
)
preprocessing time 0, space
O
(
n
)
(store the graph), query time
O
(
n
)
Eager strategy
precompute APSP, complete distance matrix, one table lookup to answer query
d
G
(
v,w
)
preprocessing time and space
O
(
n
2
)
, query time
O
(1)
Oracle
something “between” SSSP and APSP? applications: route planning, trafﬁc simulations, etc.
main concern:
preprocessing time
(running time of the ﬁrst algorithm),
space
consumption of the data struc-
ture (size of the output of the ﬁrst algorithm), and
query time
(running time of the second algorithm) — in
particular,
tradeoffs
between these quantities
Recall: MSSP data structure
preprocessing time and space
O
(
n
log
n
)
, query time
O
(log
n
)
(queries how-
ever restricted to source on single face)
r
–division approach
pieces of size
O
(
r
)
with boundary
O
(
√
r
)
per piece (total boundary
O
(
n/
√
r
)
)
precompute APSP for all nodes on the boundary, space
O
(
n
2
/r
)
; at query time, explore piece of
v
(say
P
v
)
and piece of
w
(
P
w
) and ﬁnd best connection pair
∂P
v
×
∂P
w
, piece sizes
O
(
r
)
and
O
(
√
r
)
2
connection pairs,
total query time
O
(
r
)
smoothly interpolates between SSSP and APSP (only separators used, extends to
minor-free graphs). can we do better?
Connections between pieces
O
(
√
r
)
2
connection pairs in
∂P
v
×
∂P
w
, not independent!
(assume boundary
∂P
on
O
(1)
cycles,
r
–division with
O
(1)
holes
per piece
P
)
1