Faster Replacement Paths and Distance Sensitivity Oracles
Authors: Grandoni Fabrizio , Williams Virginia Vassilevska 
Published: December 2019

Shortest paths computation is one of the most fundamental problems in computer science. An important variant of the problem is when edges can fail, and one needs to compute shortest paths that avoid a (failing) edge. More formally, given a source node
s
, a target node
t
, and an edge
e
, a
replacement path
for the triple (
s
,
t
,
e
) is a shortest
s
-
t
path avoiding edge
e
. Replacement paths computation can be seen either as a static problem or as a data structure problem. In the static setting, a typical goal is to compute for fixed
s
and
t
, for every possible failed edge
e
, the length of the best replacement path around
e
(
replacement paths problem
). In the data structure setting, a typical goal is to design a data structure (
distance sensitivity oracle
) that, after some preprocessing,
quickly
answers queries of the form: What is the length of the replacement path for the triple (
s
,
t
,
e
)?

In this article, we focus on
n
-node directed graphs with integer edge weights in [−
M
,
M
], and present improved replacement paths algorithms and distance sensitivity oracles based on fast matrix multiplication. In more detail, we obtain the following main results:

• We describe a replacement paths algorithm with runtime Õ(
Mn
ω
), where ω < 2.373 is the fast matrix multiplication exponent. For a comparison, the previous fastest algorithms have runtime õ(
Mn
1+2ω /3
) [Weimann,Yuster—FOCS’10] and, in the unweighted case, õ(
n
2.5
) [Roditty, Zwick—ICALP’05]. Our result shows that, at least for small integer weights, the replacement paths problem in directed graphs may be easier than the related all-pairs shortest paths problem, as the current best runtime for the latter is õ(
M
1\4−ω
n
2+1 \ 4−ω
): this is Ω (
n
2.5
) even if ω = 2. Our algorithm also implies that the
k
shortest simple
s
-
t
paths can be computed in õ(
kMn
ω
) time.

• We consider the
single-source
generalization of the replacement paths problem, where only the source
s
is fixed. We show how to solve this problem in all-pairs shortest paths time, currently õ(
M
1\4−ω
n
2+1\4−ω
). Our runtime reduces to õ(
Mn
ω
) for positive weights, hence matching our mentioned result for the simpler replacement paths case (that, however, holds also for nonpositive weights). One of the ingredients that we use is an algorithm to compute the distances from a set
s
of source nodes to a set
T
of target nodes in õ(
Mn
ω
+|
S
|ṡ |
T
|ṡ (
Mn
)
1\4−ω
) time. This improves on a result in Yuster,Zwick—FOCS’05.

• We present the first distance sensitivity oracle that achieves simultaneously subcubic preprocessing time and sublinear query time. More precisely, for a given parameter α ∈ [0,1], our oracle has preprocessing time Õ(
Mn
ω + 1\ 2
+
Mn
ω + α (4−ω)
) and query time Õ(
n
1−&alpha
). The previous best oracle for small integer weights has Õ(
Mn
ω +1−α
) preprocessing time and (superlinear) Õ(
n
1+α
) query time [Weimann,Yuster-FOCS’10]. From a technical point of view, an interesting and novel aspect of our oracle is that it exploits as a subroutine our single-source replacement paths algorithm. We also present an oracle with the same preprocessing time as in Weimann,Yuster—FOCS’10 and with smaller query time õ(
n
1−1−α\4−ω
+
n
2α
).