alphaFeedback

WorksComputer Science

Simplified and Faster Algorithms for the Directed Single/Dual-Failure Replacement Paths via Modulo-Layer Hitting Sets

AI contributions
  • GPT-6 Astra · OpenAI
  • Claude Fable 5.1 · bare
View details

Abstract

We study the replacement paths problem in unweighted directed graphs with nn vertices and mm edges under one or two edge failures. We give simpler and faster algorithms for both settings. Both algorithms are based on a new technique, which we call modulo-layer hitting sets. For the single-failure setting, we obtain a simple deterministic combinatorial algorithm running in O(mn)O(m\sqrt{n}) time, which is nearly optimal under the combinatorial Boolean Matrix Multiplication (BMM) conjecture. In addition to removing the logarithmic overhead of the deterministic O~(mn)\tilde{O}(m\sqrt{n})-time algorithm of Alon, Chechik, and Cohen~[ICALP'19], our algorithm admits a much simpler implementation and analysis. For the dual-failure setting, we obtain a randomized combinatorial algorithm running in O~(n3−1/4)\tilde{O}(n^{3-1/4}) time. This improves upon the previous O~(n3−1/18)\tilde{O}(n^{3-1/18})-time combinatorial algorithm of Chechik and Zhang~[ICALP'24].

Introduction

In the replacement paths problem, we study how shortest paths change under edge failure. Specifically, given an unweighted directed graph G=(V,E)G=(V,E) with nn vertices and mm edges and two vertices s,t∈Vs,t \in V, the classical replacement paths (RP) problem asks to compute, for every edge e∈Ee \in E, a shortest ss-tt path that avoids ee. Its natural two-failure extension, the dual-failure replacement paths (2-FRP) problem, asks to compute, for every pair of edges e,e′∈Ee,e' \in E, a shortest ss-tt path that avoids both ee and e′e'.

The replacement paths problem has been extensively studied in the literature [31, 33, 26, 19, 18, 42, 5, 16, 41, 39, 44, 30, 21, 10 VWX22, 11, 32, 8, 35, 22], motivated in part by its role as a basic model for fault-tolerant routing. In real-world networks, links may become unavailable due to failures, and it is desirable to quickly find alternative routes while preserving shortest-path guarantees. Replacement paths naturally capture this task by computing shortest routes that remain available after such failures. Beyond this networking motivation, replacement paths are also closely connected to several fundamental problems. In particular, replacement paths arise in computing Vickrey pricing for shortest paths in algorithmic mechanism design (see [34, 25]). They are also closely related to the kk shortest paths problem, which is itself a classical and well-studied problem [29, 17].

For the classical RP problem, the complexity differs significantly between undirected and directed graphs. Note that the output size of RP is only Θ(n)\Theta(n), since it suffices to consider failures of edges on a fixed shortest ss–tt path. For undirected graphs, RP can be solved essentially as efficiently as single-source shortest paths [31, 30]. In contrast, RP on directed graphs appears substantially harder. For unweighted directed graphs, Roditty and Zwick [39] gave a randomized combinatorial algorithm running in O~(mn)\tilde{O}(m\sqrt{n}) time. Obtaining a deterministic algorithm with a comparable running time remained open for more than a decade, until Alon, Chechik, and Cohen [1] gave a deterministic O~(mn)\tilde{O}(m\sqrt{n})-time combinatorial algorithm. This running time is optimal up to no(1)n^{o(1)} factor among combinatorial algorithms, assuming the combinatorial Boolean Matrix Multiplication (BMM) conjecture [43]. For weighted directed graphs, RP is subcubic-equivalent to APSP [43].3 For algebraic algorithms, Vassilevska Williams [41] gave a randomized O~(Mnω)\tilde{O}(Mn^\omega)-time algorithm4 for edge weights in {−M,…,M}\{-M,\ldots,M\}.

Although the notion of a “combinatorial algorithm” is not formally defined, here and throughout we use the term informally to refer to algorithms that do not rely on fast matrix multiplication, such as Strassen-like methods. Such algorithms are often viewed as more efficient in practice, since fast matrix multiplication algorithms typically involve large hidden constants. We refer the reader to [3 Section 1.1] for a more extensive discussion of the motivations for seeking combinatorial algorithms, as well as for possible operational definitions of this notion.

The 2-FRP problem is considerably less understood. Vassilevska Williams, Woldeghebriel, and Xu [VWX22] gave a O~(n3)\tilde{O}(n^3)-time algorithm for weighted directed graphs and an n8/3−o(1)n^{8/3-o(1)} conditional lower bound for combinatorial algorithms on unweighted directed graphs. Chechik and Zhang [11] subsequently gave the first truly subcubic combinatorial algorithm for unweighted directed graphs, with running time O~(n3−1/18)\tilde{O}(n^{3-1/18}). For algebraic algorithms, they also obtained a O~(Mn2.8716)\tilde{O}(Mn^{2.8716})-time algorithm for edge weights in {−M,…,M}\{-M,\ldots,M\}. Thus, for combinatorial algorithms on unweighted directed graphs, there remains a substantial gap between the known upper and lower bounds. In contrast, for undirected graphs, Nogler and Vassilevska Williams [35] recently reduced 2-FRP to single source replacement paths, yielding a O~(mn+n2)\tilde{O}(m\sqrt{n}+n^2)-time algorithm for unweighted graphs. They left open whether a similar reduction, possibly in a weaker form, can be obtained for directed graphs. We note that, although 2-FRP considers all pairs of failed edges, its output size is only Θ(n2)\Theta(n^2); see § 2.2 for details.

Our Results

Table 1 summarizes the best known upper and lower bounds for RP and 2-FRP, together with our new results. Our first result is a simple deterministic algorithm for the RP problem.

Theorem 1. There is a deterministic combinatorial algorithm for the RP problem on unweighted directed graphs that runs in O(mn)O(m\sqrt{n}) time.

The running time in Theorem 1 is optimal up to an no(1)n^{o(1)} factor among combinatorial algorithms [43], and removes the logarithmic overhead in the previous randomized and deterministic algorithms [39, 1].

More importantly, our derandomization is considerably simpler. The randomized algorithm of Roditty and Zwick [39] is conceptually simple, whereas its derandomization by Alon, Chechik, and Cohen [1] requires substantially more machinery, including the construction of critical paths using decremental shortest-path techniques and a greedy hitting-set procedure. To obtain a simpler deterministic algorithm, we introduce a new technique, which we call a modulo-layer hitting set. The idea is extremely simple. After performing BFS from ss, we partition the vertices into L=Θ(n)L = \Theta(\sqrt{n}) classes according to their distances from ss modulo LL, and use a smallest class, which has size at most n/L=O(n)n/L = O(\sqrt{n}), as the hitting set. We believe that the resulting algorithm is simple enough for textbook presentation and practical implementation.

Combined with the reduction of Roditty and Zwick [39], Theorem 1 also yields an efficient algorithm for computing the kk shortest simple ss–tt paths.

Corollary 2. There is a deterministic combinatorial algorithm for the kk simple shortest paths problem on unweighted directed graphs that runs in O(kmn)O(km\sqrt{n}) time.

Roditty and Zwick [39] reduced the kk simple shortest paths problem to O(k)O(k) instances of the replacement paths problem. Thus, Corollary 2 follows from Theorem 1 without any logarithmic overhead.

Our second result is a faster combinatorial algorithm for the 2-FRP problem. Our algorithm builds on our new modulo-layer hitting-set technique introduced for RP and combines it with additional ideas.

Theorem 3. There is a randomized combinatorial algorithm for the 2-FRP problem on unweighted directed graphs that runs in O~(n3−1/4)\widetilde{O}(n^{3-1/4}) time.

Our algorithm improves the previous combinatorial bound O~(n3−1/18)\widetilde{O}(n^{3-1/18}) and is simpler than the previous algorithm of Chechik and Zhang [11]. Our algorithm also reduces directed 2-FRP to a collection of multiple-source replacement paths (MSRP) instances. This reduction can be viewed as a partial answer to the question of Nogler and Vassilevska Williams [35]. We then solve the resulting MSRP instances using the recent algorithm of Harada and Izumi [22] for directed graphs.

Our results demonstrate that our new modulo-layer hitting-set technique is useful for both directed RP and 2-FRP. We believe that this simple technique may also find applications to other related shortest-path problems.

Additional Related Work

Fast algorithms for replacement paths have also been studied on special graph classes, including planar graphs [18, 42] and surface embedded graphs [16]. Another line of work considers fast approximation algorithms [5, 12]. The replacement paths problem has been studied in distributed settings [32, 8].

A closely related line of work studies distance sensitivity oracles (DSOs), which can be viewed as a data-structure version of replacement paths. After preprocessing a graph, a DSO answers shortest-path distance queries efficiently under edge or vertex failures. DSOs have also been extensively studied in the literature [6, 21 CC20, 20, 38, 15, 28, 14, 23].

DirectionWeightsDet./Rand.Upper BoundLower Bound
Replacement Paths (RP)
undir.[1,nc][1,n^c]det.O(m+nlog⁡n)O(m+n\log n) [31]Ω(m+n)\Omega(m+n)
dir.[1,nc][1,n^c]det.APSP-time [43]Ω(m+n)\Omega(m+n)
dir.[−M,M][-M,M]rand.O~(Mnω)\widetilde{O}(Mn^\omega) [41]Ω(m+n)\Omega(m+n)
undir.unweigh.det.O(m+n)O(m+n) [30]Ω(m+n)\Omega(m+n)
dir.unweigh.det.O(mn)O(m\sqrt{n}) [Theorem 1]mn1/2−o(1)mn^{1/2-o(1)}† [43]
Dual-Failure Replacement Paths (2-FRP)
undir.[1,nc][1,n^c]det.APSP-time [35]APSP-time [24, 9]
dir.[1,nc][1,n^c]det.O~(n3)\widetilde{O}(n^3) [VWX22]APSP-time [43]
undir.[1,M][1,M]rand.O~(Mnω)\widetilde{O}(Mn^\omega) [35]Ω(n2)\Omega(n^2)
dir.[−M,M][-M,M]rand.O~(Mn2.8716)\widetilde{O}(Mn^{2.8716}) [11]Ω(n2)\Omega(n^2)
undir.unweigh.det.O~(mn+n2)\widetilde{O}(m\sqrt{n}+n^2) [35]mn1/2−o(1)mn^{1/2-o(1)}† [35]
dir.unweigh.rand.O~(n3−1/4)\widetilde{O}(n^{3-1/4}) [Theorem 3]n8/3−o(1)n^{8/3-o(1)}† [VWX22]

Table 1. Best known results and our results for RP and 2-FRP. Lower bounds marked with † apply to combinatorial algorithms and are conditional on the combinatorial BMM conjecture.

Preliminaries

Notation

Let G=(V,E)G=(V,E) be a directed graph with n=∣V∣n=|V| vertices and m=∣E∣m=|E| edges. For an edge set F⊆EF\subseteq E, we write G∖FG\setminus F for the graph obtained from GG by removing all edges in FF. For an edge e∈Ee\in E, we simply write G∖eG\setminus e instead of G∖{e}G\setminus\{e\}. For a directed graph DD, let DrevD^{\mathrm{rev}} denote the graph obtained by reversing every edge of DD. For a vertex subset V′⊆V(D)V'\subseteq V(D), let D[V′]D[V'] denote the subgraph of DD induced by V′V'.

For a directed graph DD, possibly with edge weights, and vertices u,vu,v, we denote by dist⁡D(u,v)\operatorname{dist}_D(u,v) the length of a shortest uu–vv path in DD, or its minimum total weight when DD is weighted. We set dist⁡D(u,v)=∞\operatorname{dist}_D(u,v)=\infty if u∉V(D)u\notin V(D), v∉V(D)v\notin V(D), or DD contains no uu–vv path.

For a directed path or walk ρ\rho in GG, we denote its vertex set and edge set by V(ρ)V(\rho) and E(ρ)E(\rho), respectively. We let ∣ρ∣|\rho| denote the number of edges in ρ\rho. For any u,v∈V(ρ)u,v\in V(\rho) where uu comes before vv on ρ\rho, we write ρ[u,v]\rho[u,v] for the subpath of ρ\rho from uu to vv, and dist⁡ρ(u,v)\operatorname{dist}_{\rho}(u,v) for the length of this subpath. For two directed paths or walks α\alpha and β\beta such that the last vertex of α\alpha is the first vertex of β\beta, we denote their concatenation by α∘β\alpha\circ\beta.

Throughout the paper, let π=⟨v0,v1,…,vk⟩\pi=\langle v_0,v_1,\ldots,v_k\rangle be a fixed shortest path in GG from s=v0s=v_0 to t=vkt=v_k, and let H:=G∖E(π)H:=G\setminus E(\pi). For a path τ\tau, let H+τH+\tau denote the graph obtained from HH by adding all edges of τ\tau.

For integers a,ba,b and a positive integer LL, we write a≡b(modL)a\equiv b\pmod{L} if LL divides a−ba-b.

Replacement Paths and Variants

(Single-Failure) Replacement Paths (RP). Given a directed graph GG, two vertices s,ts,t, and a shortest ss–tt path π\pi, the replacement paths (RP) problem asks to compute dist⁡G∖e(s,t)\operatorname{dist}_{G\setminus e}(s,t) for every edge e∈Ee\in E. It suffices to consider edges on π\pi, since removing an edge outside π\pi does not change the ss–tt distance. Since π\pi contains at most n−1n-1 edges, the output size of RP is O(n)O(n).

Dual-Failure Replacement Paths (2-FRP). The dual-failure replacement paths (2-FRP) problem extends RP to two edge failures. The goal is to compute dist⁡G∖{e,e′}(s,t)\operatorname{dist}_{G\setminus\{e,e'\}}(s,t) for every pair of edges e,e′∈Ee,e' \in E.

Although there are O(m2)O(m^2) possible pairs of failed edges, the output size of 2-FRP is only O(n2)O(n^2). Indeed, it suffices to consider e∈E(π)e \in E(\pi) and, for each such edge ee, only the edges e′e' on a shortest ss–tt path in G∖eG \setminus e. All other distances are equal to either dist⁡G(s,t)\operatorname{dist}_{G}(s,t) or dist⁡G∖e(s,t)\operatorname{dist}_{G\setminus e}(s,t). Thus, only O(n2)O(n^2) nontrivial output values need to be represented.

Multiple Source Replacement Paths

In the multiple source replacement paths (MSRP) problem, we are given a graph and a set SS of σ\sigma sources. For every source u∈Su \in S, a shortest-path tree TuT_u rooted at uu is fixed, and the output consists of the distances dist⁡G∖e(u,v)\operatorname{dist}_{G\setminus e}(u,v) for all vv and all edges ee on the tree path Tu[u,v]T_u[u,v]. For e∉E(Tu[u,v])e \notin E(T_u[u,v]) the tree path survives, so dist⁡G∖e(u,v)=dist⁡G(u,v)\operatorname{dist}_{G\setminus e}(u,v)=\operatorname{dist}_{G}(u,v). The case σ=1\sigma=1 is the single source replacement paths SSRP problem.

Lemma 4 (Theorem 1 of [22]). MSRP on unweighted directed graphs can be solved by a randomized combinatorial algorithm in O~(mσn+σn2)\widetilde{O}(m\sqrt{\sigma n}+\sigma n^2) time, with all output distances correct with high probability. In particular, setting σ=1\sigma=1 gives an O~(mn+n2)\widetilde{O}(m\sqrt{n}+n^2)-time algorithm for SSRP.

2-FRP for Weighted Directed Graphs

Our 2-FRP algorithm reduces groups of failure pairs to small weighted instances, on which we run the algorithm of Vassilevska Williams, Woldeghebriel, and Xu [VWX22] as a black box. They proposed algorithms for 2-FRP on an nn-vertex directed graph with integer edge weights and no negative cycles in O(n3log⁡2n)O(n^3\log^2 n) time deterministically, or in O(n3log⁡n)O(n^3\log n) time with high probability.

Lemma 5 (Lemmas 4.3 and 4.4 of [VWX22]). Let GG be a directed graph with nn vertices, polynomially bounded integer edge weights, and no negative cycles, let s,t∈V(G)s,t \in V(G), and let π\pi be a shortest ss–tt path in GG given as part of the input. The distances dist⁡G∖{e,e′}(s,t)\operatorname{dist}_{G\setminus\{e,e'\}}(s,t) for all pairs of edges e,e′∈E(π)e,e' \in E(\pi) can be computed by a deterministic combinatorial algorithm in O~(n3)\widetilde{O}(n^3) time.

Canonical Replacement Paths

We use the notion of a canonical replacement path introduced in [VWX22]; see also [11], Definition 3 in the conference version.

Definition 6 (Canonical path). Let π\pi be a shortest ss–tt path, and let F⊆EF \subseteq E be a set of failed edges. An ss–tt path ρ\rho in G∖FG \setminus F is canonical with respect to π\pi and FF if, for any u,v∈V(π)∩V(ρ)u,v \in V(\pi) \cap V(\rho) such that uu appears before vv in both π,ρ\pi,\rho and E(π[u,v])∩F=∅E(\pi[u,v]) \cap F=\varnothing, then ρ[u,v]\rho[u,v] is the same as π[u,v]\pi[u,v].

Throughout the paper, in both the single-failure and dual-failure settings, whenever we consider a shortest replacement path, we choose it to be canonical. Such a canonical shortest replacement path always exists. Indeed, among all shortest ss–tt paths in G∖FG \setminus F, choose ρ\rho minimizing ∣E(ρ)∖E(π)∣|E(\rho)\setminus E(\pi)|. If ρ\rho is not canonical, then for some violating pair u,vu,v, replacing ρ[u,v]\rho[u,v] by π[u,v]\pi[u,v] yields another shortest ss–tt path with fewer edges outside π\pi, which contradicts the choice of ρ\rho.

Basic Fact on Single-Failure Replacement Paths

For two vertices va,vb∈V(π)v_a,v_b \in V(\pi) with a<ba<b, we call a shortest vav_a–vbv_b path in HH a detour. A standard structural fact about single-failure replacement paths is that a shortest replacement path can be decomposed into a prefix of π\pi, followed by a single detour, and then a suffix of π\pi; see, e.g., [10 Lemma 5]. See Figure 1 for an illustration. This gives the following identity, which forms the basis of fast algorithms for single-failure replacement paths.

A shortest replacement path avoiding the failed edge

Figure 1. A shortest replacement path avoiding the failed edge e=(vi,vi+1)e=(v_i,v_{i+1}).

Lemma 7. Let H:=G∖E(π)H := G \setminus E(\pi). For every edge e=(vi,vi+1)∈E(π)e=(v_i,v_{i+1}) \in E(\pi),

dist⁡G∖e(s,t)=min⁡0≤a≤i<b≤k{dist⁡π(s,va)+dist⁡H(va,vb)+dist⁡π(vb,t)}\operatorname{dist}_{G\setminus e}(s,t)=\min_{0\leq a\leq i<b\leq k}\left\{\operatorname{dist}_{\pi}(s,v_a)+\operatorname{dist}_{H}(v_a,v_b)+\operatorname{dist}_{\pi}(v_b,t)\right\}

Our New Simple Deterministic Algorithm for RP

We first introduce our new derandomization technique for the RP problem, which we call a modulo-layer hitting set. The same technique will later be applied to the 2-FRP problem.

By Lemma 7, a central task in designing fast RP algorithms is to efficiently compute the detour distances dist⁡H(va,vb)\operatorname{dist}_{H}(v_a,v_b) for pairs of vertices va,vb∈V(π)v_a,v_b \in V(\pi). Since there can be Θ(n2)\Theta(n^2) such pairs, these distances are usually not computed explicitly. Instead, they are computed implicitly. We first briefly review how previous algorithms handle these detours, and then describe our approach based on the modulo-layer hitting-set technique.

Previous randomized approach [39]. The randomized algorithm of Roditty and Zwick [39] is conceptually simple. It distinguishes replacement paths whose detour has at most ⌈n⌉\lceil\sqrt{n}\rceil edges from those whose detour has more than ⌈n⌉\lceil\sqrt{n}\rceil edges. Short detours are found deterministically. For long detours, a set R\mathcal{R} of pivots is chosen by including every vertex independently with probability clog⁡n/nc\log n/\sqrt{n} for a sufficiently large constant cc, and the distances in HH between the vertices of π\pi are computed by a BFS in each direction from every pivot. Since a long detour has more than ⌈n⌉\lceil\sqrt{n}\rceil vertices, with high probability every long detour contains a pivot. Consequently, for every long detour from vav_a to vbv_b, we have dist⁡H(va,vb)=min⁡r∈R{dist⁡H(va,r)+dist⁡H(r,vb)}\operatorname{dist}_{H}(v_a,v_b)=\min_{r\in\mathcal{R}}\{\operatorname{dist}_{H}(v_a,r)+\operatorname{dist}_{H}(r,v_b)\}.

Previous deterministic approach [1]. Derandomizing the pivot-selection step above is substantially more technically challenging. Alon, Chechik, and Cohen [1] obtained the first deterministic O(mnlog⁡n)O(m\sqrt{n}\log n)-time algorithm. Their proof and algorithm require constructing a carefully chosen family of O(n)O(n) critical paths, each path containing ⌈n⌉\lceil\sqrt{n}\rceil edges. Computing this family efficiently requires a variant of the decremental single-source shortest-path algorithm of King [27]. They then apply a greedy hitting-set procedure to the family of critical paths, obtaining a set of O(nlog⁡n)O(\sqrt{n}\log n) pivots that hits every critical path. These pivots are subsequently used within the framework of Roditty and Zwick [39]. The logarithmic factors in the size of the hitting set and in its computation account for the O~(⋅)\tilde{O}(\cdot) in the running time.

Overview of our approach. Our underlying idea is entirely different, and both the algorithm and its analysis are remarkably simple. The key difference is that we do not classify detours by their length, as in [39, 1]; instead, we classify them by whether they pass through the hitting set or stay within a small range of consecutive BFS layers from ss, which we call a block (defined below).

Instead of constructing a hitting set for a carefully chosen family of critical paths, we obtain one directly from a single BFS from ss. We group the vertices by their distance from ss modulo a parameter L=Θ(n)L = \Theta(\sqrt{n}), and let R\mathcal{R} consist of the vertices in a smallest group, which has size at most n/L=O(n)n/L = O(\sqrt{n}). In other words, for some 0≤ℓ⋆<L0 \le\ell^\star< L, R\mathcal{R} is the union of the BFS layers at distances hq:=ℓ⋆+qLh_q := \ell^\star+ qL from ss (q≥0q \ge0), where the BFS layer at distance dd is the set of vertices at distance exactly dd from ss; we call these layers the separator layers. A block consists of two consecutive separator layers and all layers between them, i.e., the vertices at distances hq−1,hq−1+1,…,hqh_{q-1}, h_{q-1} + 1, \ldots, h_q from ss for some q≥0q \ge0; see Figure 2 for an illustration.

Separator layers and blocks of Algorithm 1

Figure 2. Separator layers and blocks of Algorithm 1.

Since dist⁡G(s,y)≤dist⁡G(s,x)+1\operatorname{dist}_G(s,y) \le\operatorname{dist}_G(s,x) + 1 for every edge (x,y)(x,y) of GG, the following holds for every q≥0q \ge0: any path in a subgraph of GG that starts at a vertex at distance less than hqh_q from ss and ends at a vertex at distance at least hqh_q must contain a vertex at distance exactly hqh_q, i.e., a vertex of the separator layer at distance hqh_q, which belongs to R\mathcal{R}. In fact, the same structural property is what lets the technique carry over to the 2-FRP problem, where the graph in which detours are sought changes with the second failure (§ 4).

Using this structural property, we show that every detour either visits a separator layer, i.e., contains a vertex of R\mathcal{R}, or stays inside a single block. Thus, R\mathcal{R} serves as a hitting set for all detours that leave their block. Accordingly, the detour distances can be evaluated using two kinds of BFSs: detours of the former kind are handled by BFSs from and to every vertex of R\mathcal{R} in HH, which take O((m+n)n/L)O((m+n)n/L) time in total, and detours of the latter kind by BFSs inside each block from the vertices of π\pi in it, which take O((m+n)L)O((m+n)L) time in total.

Since neither the size of this hitting set nor its construction involves a logarithmic factor, our algorithm runs in O(mn)O(m\sqrt{n}) time, improving the O(mnlog⁡n)O(m\sqrt{n}\log n) bound of [1].

Modulo-Layer Hitting Set and Modulo-Layer Decomposition

Throughout, we fix a shortest ss–tt path π\pi in GG. Fix an integer parameter 1≤L≤n1 \le L \le n, whose value will be chosen later; we will eventually set L:=⌈n⌉L := \lceil\sqrt{n}\rceil. For i≥0i \ge0, the layer ii is the set Λi:={x∈V∣dist⁡G(s,x)=i}\Lambda_i := \{x \in V \mid\operatorname{dist}_G(s,x) = i\} of vertices at distance exactly ii from ss. For 0≤ℓ<L0 \le\ell< L, let

Rℓ:={x∈V∣dist⁡G(s,x)<∞ and dist⁡G(s,x)≡ℓ(modL)}.\mathcal{R}_{\ell} := \{x \in V \mid\operatorname{dist}_G(s,x) < \infty\text{ and } \operatorname{dist}_G(s,x) \equiv\ell\pmod{L}\}.

Choose ℓ⋆∈arg⁡min⁡ℓ∣Rℓ∣\ell^\star\in\arg\min_{\ell} |\mathcal{R}_{\ell}| and put R:=Rℓ⋆\mathcal{R} := \mathcal{R}_{\ell^\star}. Then ∣R∣≤n/L|\mathcal{R}| \le n/L. We call the layers hq:=ℓ⋆+qLh_q := \ell^\star+ qL (q≥0q \ge0), which are exactly the layers containing the vertices of R\mathcal{R}, the separator layers. The separator layers divide the set of vertices reachable from ss into blocks: with the convention h−1:=0h_{-1} := 0, for q≥0q \ge0, block qq is Vq:={x∈V∣hq−1≤dist⁡G(s,x)≤hq}V_q := \{x \in V \mid h_{q-1} \le\operatorname{dist}_G(s,x) \le h_q\}, and we let Hq:=H[Vq]H_q := H[V_q]. Recall that H:=G∖E(π)H := G \setminus E(\pi). That is, V0V_0 consists of the vertices of layers 0,…,ℓ⋆0,\ldots,\ell^\star and, for q≥1q \ge1, VqV_q consists of the vertices of the L+1L+1 consecutive layers hq−1,…,hqh_{q-1},\ldots,h_q, from one separator layer to the next, inclusive. Two consecutive blocks VqV_q and Vq+1V_{q+1} share exactly the separator layer hqh_q (i.e., Vq∩Vq+1=ΛhqV_q \cap V_{q+1} = \Lambda_{h_q}), and any two non-consecutive blocks are disjoint. Consequently, every vertex lies in at most two blocks (in exactly two if and only if it belongs to R\mathcal{R}), and every edge of HH lies in at most two of the graphs HqH_q. Finally, for q≥0q \ge0, let γq\gamma_q be the subpath of π\pi induced by VqV_q; that is, γq=π[hq−1,min⁡{hq,k}]\gamma_q = \pi[h_{q-1},\min\{h_q,k\}]. Algorithm 1 summarizes this construction and Figure 2 illustrates it.

Since a vertex of π\pi on a separator layer belongs to two blocks, we fix the following convention. For $0 \le a \le k$, let q(a)q(a) denote the unique index q≥0q \ge0 with hq−1≤a<hqh_{q-1} \le a < h_q. Explicitly, $q(a) = 0 if a<ℓ⋆a < \ell^\star, and q(a)=⌊(a−ℓ⋆)/L⌋+1q(a) = \lfloor(a-\ell^\star)/L\rfloor+ 1 otherwise. Equivalently, for a<ka < k, q(a)q(a) is the index of the unique block containing the edge ea=(va,va+1)e_a = (v_a,v_{a+1}) of π\pi, that is, ea∈E(γq(a))e_a \in E(\gamma_{q(a)}). We always have va∈Vq(a)v_a \in V_{q(a)}. If va∈Rv_a \in R, then vav_a also lies in Vq(a)−1V_{q(a)-1}, and q(a)q(a) selects the block in which vav_a is on the lower separator layer hq(a)−1h_{q(a)-1}. Note that a≤a′a \leq a' implies q(a)≤q(a′)q(a) \leq q(a').

Algorithm 1: Modulo-Layer Hitting Set and Modulo-Layer Decomposition.
1 ℓ⋆←arg⁡min⁡0≤ℓ<L∣{x∈V∣dist⁡G(s,x)≡ℓ(modL)}∣\ell^\star\gets\arg\min_{0\leq\ell<L} |\{x \in V \mid\operatorname{dist}_G(s,x) \equiv\ell\pmod{L}\}|
2 R←{x∈V∣dist⁡G(s,x)≡ℓ⋆(modL)}R \gets\{x \in V \mid\operatorname{dist}_G(s,x) \equiv\ell^\star\pmod{L}\}
3 h−1←0h_{-1} \gets0 and hq←ℓ⋆+qLh_q \gets\ell^\star+ qL for q≥0q \geq0
4 γq←π[hq−1,min⁡{hq,k}]\gamma_q \gets\pi[h_{q-1},\min\{h_q,k\}] for every q≥0q \geq0
5 Vq←{x∈V∣hq−1≤dist⁡G(s,x)≤hq}V_q \gets\{x \in V \mid h_{q-1} \leq\operatorname{dist}_G(s,x) \leq h_q\} and Hq←H[Vq]H_q \gets H[V_q] for every q≥0q \geq0 with Vq≠∅V_q \ne\varnothing

Table 1 (PDF p. 8).

Our algorithm computes the detour distances dist⁡H(va,vb)\operatorname{dist}_H(v_a,v_b) using the following lemma. Recall that dist⁡Hq(va,vb)=∞\operatorname{dist}_{H_q}(v_a,v_b) = \infty whenever va∉Vqv_a \notin V_q or vb∉Vqv_b \notin V_q.

Lemma 8. For every $0 \leq a < b \leq k$, with q=q(a)q = q(a),

dist⁡H(va,vb)=min⁡{min⁡r∈R{dist⁡H(va,r)+dist⁡H(r,vb)},dist⁡Hq(va,vb)}.\operatorname{dist}_H(v_a,v_b) = \min\left\{\min_{r\in R}\{\operatorname{dist}_H(v_a,r)+\operatorname{dist}_H(r,v_b)\},\operatorname{dist}_{H_q}(v_a,v_b)\right\}.

Proof. Every finite term on the right is the length of a walk from vav_a to vbv_b in HH. Hence, the right-hand side is at least dist⁡H(va,vb)\operatorname{dist}_H(v_a,v_b).

For the converse inequality, we may assume that dist⁡H(va,vb)<∞\operatorname{dist}_H(v_a,v_b) < \infty. Let τ\tau be a shortest vav_a–vbv_b path in HH. If τ\tau contains a vertex r⋆∈Rr^\star\in R (possibly r⋆=var^\star= v_a or r⋆=vbr^\star= v_b), then dist⁡H(va,r⋆)+dist⁡H(r⋆,vb)=∣τ[va,r⋆]∣+∣τ[r⋆,vb]∣=∣τ∣=dist⁡H(va,vb)\operatorname{dist}_H(v_a,r^\star) + \operatorname{dist}_H(r^\star,v_b) = |\tau[v_a,r^\star]| + |\tau[r^\star,v_b]| = |\tau| = \operatorname{dist}_H(v_a,v_b). Otherwise, no vertex of τ\tau lies on a separator layer, and we claim that every vertex xx of τ\tau satisfies hq−1<dist⁡G(s,x)<hqh_{q-1} < \operatorname{dist}_G(s,x) < h_q. Indeed, τ\tau starts at vav_a with a<hqa < h_q; if some vertex of τ\tau had layer at least hqh_q, then τ\tau would contain a vertex of layer exactly hqh_q, which is a separator layer. Similarly, τ\tau ends at vbv_b with b>hq−1b > h_{q-1}; if some vertex of τ\tau had layer less than hq−1h_{q-1}, τ\tau would contain a vertex of layer exactly hq−1h_{q-1}, which is a separator layer. Thus, all vertices of τ\tau belong to VqV_q, and since HqH_q is the subgraph of HH induced by VqV_q, the path τ\tau lies in HqH_q. Therefore dist⁡Hq(va,vb)≤∣τ∣=dist⁡H(va,vb)\operatorname{dist}_{H_q}(v_a,v_b) \leq|\tau| = \operatorname{dist}_H(v_a,v_b). □

By Lemma 8, every detour either visits a separator layer or stays inside one block, so the distance tables of Algorithm 2 suffice to evaluate the minimum in Lemma 7. Note that the detour distances dist⁡H(va,vb)\operatorname{dist}_H(v_a,v_b) are never computed explicitly: the minimum is evaluated for all failed edges at once by prefix and suffix minima along π\pi. The BFSs from and to all pivots r∈Rr \in R cost O((m+n)n/L)O((m+n)n/L) time since ∣R∣≤n/L|R| \le n/L, and the BFSs inside the blocks cost O((m+n)L)O((m+n)L) time since each γq\gamma_q has at most L+1L+1 vertices and every vertex and every edge of HH lies in at most two of the graphs HqH_q. Choosing L=⌈n⌉L=\lceil\sqrt{n}\rceil yields Theorem 1.

Algorithm 2: Preprocessing distance computation

  1. dist⁡H(r,∗)←BFS⁡(H,r)\operatorname{dist}_H(r,*) \leftarrow\operatorname{BFS}(H,r) for each r∈Rr \in R

  2. dist⁡H(∗,r)←BFS⁡(Hrev,r)\operatorname{dist}_H(*,r) \leftarrow\operatorname{BFS}(H_{\mathrm{rev}},r) for each r∈Rr \in R

  3. dist⁡Hq(v,∗)←BFS⁡(Hq,v)\operatorname{dist}_{H_q}(v,*) \leftarrow\operatorname{BFS}(H_q,v) for each 0≤q0 \le q and each v∈V(γq)v \in V(\gamma_q)

Overall Algorithm and Its Running Time.

Overall algorithm. Consider an edge ei=(vi,vi+1)∈E(π)e_i=(v_i,v_{i+1}) \in E(\pi). Substituting Lemma 7 into Lemma 8 splits the minimum over $0 \le a \le i < b \le k$ into two candidates. The first one, the pivot candidate, collects the detours that pass through a vertex of RR:

Ci:=min⁡r∈R{Ai(r)+Bi(r)},whereC_i := \min_{r \in R}\{A_i(r)+B_i(r)\}, \qquad\text{where}
Ai(r):=min⁡0≤a≤i{a+dist⁡H(va,r)}andBi(r):=min⁡i<b≤k{dist⁡H(r,vb)+k−b}.A_i(r) := \min_{0 \le a \le i}\{a+\operatorname{dist}_H(v_a,r)\} \qquad\text{and}\qquad B_i(r) := \min_{i < b \le k}\{\operatorname{dist}_H(r,v_b)+k-b\}.

The second one, the block candidate, collects the detours that stay inside the block Vq(i)V_{q(i)} containing viv_i:

Si:=min⁡0≤a≤i<b≤kva,vb∈Vq(i){a+dist⁡Hq(i)(va,vb)+k−b}.S_i := \min_{\substack{0 \le a \le i < b \le k\\v_a,v_b \in V_{q(i)}}}\{a+\operatorname{dist}_{H_{q(i)}}(v_a,v_b)+k-b\}.

Note that, for a≤i<ba \le i < b, the term dist⁡Hq(a)(va,vb)\operatorname{dist}_{H_{q(a)}}(v_a,v_b) in Lemma 8 is finite only if vb∈Vq(a)v_b \in V_{q(a)}, and then q(a)=q(i)=q(b)q(a)=q(i)=q(b) because every block consists of consecutive layers. Hence we obtain

dist⁡G∖ei(s,t)=min⁡{Ci,Si}for every 0≤i<k,\operatorname{dist}_{G\setminus e_i}(s,t)=\min\{C_i,S_i\}\qquad\text{for every }0 \le i < k,

and it remains to compute all values CiC_i and SiS_i.

Algorithm 3 gives the pseudocode of our algorithm. The pivot candidates are computed from the tables Ai(r)A_i(r) and Bi(r)B_i(r), which a prefix and a suffix scan along π\pi build for each pivot rr. The block candidates are computed in the same manner. For a block VqV_q and a vertex va∈V(γq)v_a \in V(\gamma_q), a suffix scan along γq\gamma_q builds the table

Wq,a(i):=min⁡i<b≤min⁡{hq,k}{dist⁡Hq(va,vb)+k−b}for a≤i<min⁡{hq,k},W_{q,a}(i):=\min_{i<b\le\min\{h_q,k\}}\{\operatorname{dist}_{H_q}(v_a,v_b)+k-b\} \qquad\text{for }a \le i < \min\{h_q,k\},

and then Si=min⁡hq(i)−1≤a≤i{a+Wq(i),a(i)}S_i=\min_{h_{q(i)}-1\le a\le i}\{a+W_{q(i),a}(i)\}, since va∈Vq(i)v_a \in V_{q(i)} with a≤ia \le i means hq(i)−1≤a≤ih_{q(i)}-1 \le a \le i, and vb∈Vq(i)v_b \in V_{q(i)} with b>ib>i means i<b≤min⁡{hq(i),k}i<b\le\min\{h_{q(i)},k\}.

Running time. Algorithms 1 and 2 take O(m)O(m) time and O(mL+mn/L)O(mL+mn/L) time, respectively. For the pivot candidates, each of the ∣R∣≤n/L|R| \le n/L pivots performs two scans of π\pi, each in O(k)=O(n)O(k)=O(n) time, which is O(n2/L)O(n^2/L) in total. For the block candidates, each block contains at most L+1L+1 vertices of π\pi and is processed in O(L2)O(L^2) time; since π\pi meets at most k/L+1=O(n/L)k/L+1=O(n/L) blocks, this is O(nL)O(nL) in total. Therefore, the total running time is O(mn/L+mL+n2/L+nL)O(mn/L+mL+n^2/L+nL). By choosing L=⌈n⌉L=\lceil\sqrt{n}\rceil, we obtain O(mn)O(m\sqrt{n}) time, which proves Theorem 1.

Algorithm 3: The deterministic algorithm for RP.
Input: An unweighted directed graph $G=(V,E)$$ and vertices $s,t\in V$.
Output: $\operatorname{dist}_{G\setminus e_i}(s,t)$ for every edge $e_i=(v_i,v_{i+1})$ of $\pi$.
1  $L\leftarrow\lceil\sqrt{n}\rceil$, and run Algorithms 1 and 2
// Pivot candidates $C_i$
2  foreach $r\in\mathcal{R}$ do
3  $A\leftarrow\infty$
4  for $i\leftarrow 0$ to $k-1$ do
5  $A\leftarrow\min\{A,\ i+\operatorname{dist}_{H}(v_i,r)\}$
6  $A_i(r)\leftarrow A$
7  $B\leftarrow\infty$
8  for $i\leftarrow k-1$ downto $0$ do
9  $B\leftarrow\min\{B,\ \operatorname{dist}_{H}(r,v_{i+1})+k-(i+1)\}$
10 $B_i(r)\leftarrow B$
11 $C_i\leftarrow\min_{r\in\mathcal{R}}\{A_i(r)+B_i(r)\}$ for all $0\leq i<k$
// Block candidates $S_i$
12 foreach block $V_q$ do
13 foreach $v_a\in V(\gamma_q)$ do
14 $W\leftarrow\infty$
15 for $i\leftarrow\min\{h_q,k\}-1$ downto $a$ do
16 $W\leftarrow\min\{W,\ \operatorname{dist}_{H_q}(v_a,v_{i+1})+k-(i+1)\}$
17 $W_{q,a}(i)\leftarrow W$
18 $S_i\leftarrow\min_{h_q-1\leq a\leq i}\{a+W_{q,a}(i)\}$ for all $i$ with $q(i)=q$
19 return $\min\{C_i,S_i\}$ for all $0\leq i<k$

Our Improved Combinatorial Algorithm for 2-FRP

In this section, we present our improved combinatorial algorithm for the 2-FRP problem.

We divide the cases into two based on the position of the two failed edges e,e′e,e' as follows:

  1. One failure on π\pi: e∈E(π),e′∉E(π)e\in E(\pi), e'\notin E(\pi)

  2. Both failures on π\pi: e,e′∈E(π)e,e'\in E(\pi)

The first case is discussed in § 4.1, and the second case in Section 4.2. In both cases, we use the modulo-layer hitting set and the modulo-layer decomposition (§ 3.1), which is the key to making our algorithm faster and simpler than that of Chechik and Zhang [11].

Note that we do not consider the case of e,e′∉E(π)e,e'\notin E(\pi) because π\pi is the shortest in this situation. Also, in the first case, we only consider e′e' on the shortest ss–tt path in G∖eG\setminus e. More precisely, for e∈E(π)e\in E(\pi), let ρe\rho_e be a fixed shortest ss–tt path in G∖eG\setminus e, that is, a replacement path for ee. Then, we consider e′∈E(ρe)∖E(π)e'\in E(\rho_e)\setminus E(\pi).

One Failure on π\pi

In the previous work by Chechik and Zhang [11], the running time in this case is O~(n3−1/18)\widetilde{O}(n^{3-1/18}). In this paper, we give an algorithm in O~(mn3/4+n5/2)\widetilde{O}(mn^{3/4}+n^{5/2}) time for this case.

Lemma 9 (One failure on π\pi). All values of dist⁡G∖{e,e′}(s,t)\operatorname{dist}_{G\setminus\{e,e'\}}(s,t) with e∈E(π)e \in E(\pi) and e′∉E(π)e' \notin E(\pi) can be computed with high probability in O~(mn3/4+n5/2)\widetilde{O}(mn^{3/4}+n^{5/2}) time.

Throughout this subsection, we set L=⌈n⌉L=\lceil\sqrt{n}\rceil. Our algorithm for this case has two ingredients: the layer structure of § 3 and the recent combinatorial algorithm of Harada and Izumi [22] for multiple source replacement paths (MSRP) problem.

We can use the modulo-layer hitting set and the modulo-layer decomposition (§ 3.1) without any change. Roughly speaking, since e′∉E(π)e' \notin E(\pi), the only difference from the single-failure setting is that we need to search for detours in H∖e′H\setminus e' instead of HH. This change affects neither the layer structure nor its key property, since the separator layers, R\mathcal{R}, and the blocks VqV_q depend only on the distances from ss in GG, and dist⁡G(s,y)≤dist⁡G(s,x)+1\operatorname{dist}_G(s,y)\leq\operatorname{dist}_G(s,x)+1 holds for every edge (x,y)(x,y) of H∖e′H\setminus e'. Hence, for every e′e' and every 0≤a<b≤k0\leq a<b\leq k, every vav_a–vbv_b path in H∖e′H\setminus e' either contains a vertex of R\mathcal{R} or lies entirely in Hq(a)∖e′H_{q(a)}\setminus e'. In other words, we do not need to construct a hitting set separately for each failure e′∉E(π)e'\notin E(\pi); the single set R\mathcal{R} serves as a hitting set for all of them simultaneously. This allows us to avoid the extensive case analysis of Chechik and Zhang [11], which makes our algorithm for this case considerably simpler than theirs.

Formally, Lemmas 7 and 8 hold verbatim with HH and HqH_q replaced by H∖e′H\setminus e' and Hq∖e′H_q\setminus e', as stated below.

Lemma 10. For every edge e=(vi,vi+1)∈πe=(v_i,v_{i+1})\in\pi and every edge e′∉E(π)e'\notin E(\pi),

dist⁡G∖{e,e′}(s,t)=min⁡0≤a≤i<b≤k{dist⁡π(s,va)+dist⁡H∖e′(va,vb)+dist⁡π(vb,t)}.\operatorname{dist}_{G\setminus\{e,e'\}}(s,t)=\min_{0\leq a\leq i<b\leq k}\left\{\operatorname{dist}_{\pi}(s,v_a)+\operatorname{dist}_{H\setminus e'}(v_a,v_b)+\operatorname{dist}_{\pi}(v_b,t)\right\}.

Lemma 11. For each 0≤a<b≤k0\leq a<b\leq k and each edge e′∉E(π)e'\notin E(\pi), with q=q(a)q=q(a),

dist⁡H∖e′(va,vb)=min⁡{min⁡r∈R{dist⁡H∖e′(va,r)+dist⁡H∖e′(r,vb)},dist⁡Hq∖e′(va,vb)}.\operatorname{dist}_{H\setminus e'}(v_a,v_b)=\min\left\{\min_{r\in\mathcal{R}}\left\{\operatorname{dist}_{H\setminus e'}(v_a,r)+\operatorname{dist}_{H\setminus e'}(r,v_b)\right\},\operatorname{dist}_{H_q\setminus e'}(v_a,v_b)\right\}.

Proof of Lemmas 10 and 11. The two lemmas are the counterparts of Lemmas 7 and 8 with HH replaced by H∖e′H\setminus e', and their proofs are almost identical to those given there; we therefore only indicate the differences and omit the details. For Lemma 10, the subpaths of π\pi avoid e′e' because e′∉E(π)e'\notin E(\pi), and the middle part of a shortest ss–tt path in G∖{e,e′}G\setminus\{e,e'\} between its last vertex vav_a with a≤ia\leq i and its first vertex vbv_b with b>ib>i lies in H∖e′H\setminus e', since it has no internal vertex on π\pi and avoids e′e'. For Lemma 11, a shortest vav_a–vbv_b path in H∖e′H\setminus e' is in particular a path of HH, so the argument on layers applies verbatim; its subpaths are shortest paths in H∖e′H\setminus e', and when all of its vertices lie in VqV_q, it is a path of Hq∖e′H_q\setminus e'.

By Lemmas 10 and 11, all values dist⁡G∖{e,e′}(s,t)\operatorname{dist}_{G\setminus\{e,e'\}}(s,t) with e∈E(π)e\in E(\pi) and e′∉E(π)e'\notin E(\pi) are determined by the distances dist⁡H∖e′(r,∗)\operatorname{dist}_{H\setminus e'}(r,*) and dist⁡H∖e′(∗,r)\operatorname{dist}_{H\setminus e'}(*,r) for r∈Rr\in\mathcal{R} and dist⁡Hq∖e′(vi,∗)\operatorname{dist}_{H_q\setminus e'}(v_i,*) for vi∈Vqv_i\in V_q, over all e′e'. To compute these three distances, we solve the instance of the multiple source replacement paths (MSRP) problem of § 2.3, for which Harada and Izumi [22] give a combinatorial O~(mσn+σn2)\widetilde{O}(m\sqrt{\sigma n}+\sigma n^2)-time algorithm with σ\sigma sources (Lemma 4). Each of the three families above is exactly the output of one MSRP instance: for a graph G′G' and a set SS of sources, MSRP(G′,S)(G',S) returns dist⁡G′∖e′(u,x)\operatorname{dist}_{G'\setminus e'}(u,x) for every u∈Su\in S, every vertex xx, and every edge e′e' of G′G' (for e′e' off the fixed shortest-path tree of uu, the distance is dist⁡G′(u,x)\operatorname{dist}_{G'}(u,x)). Algorithm 4 is therefore the counterpart of Algorithm 2 in which every BFS is replaced by an MSRP computation. The sources of the first two instances are the ∣R∣≤n/L|\mathcal{R}|\leq n/L vertices of R\mathcal{R}, and the instance for a block VqV_q has at most L+1L+1 sources, so by Lemma 4 the total time is O~(mn/L+n3/L)\widetilde{O}(mn/\sqrt{L}+n^3/L) for lines 1 and 2 and O~(mLn+Ln2)\widetilde{O}(m\sqrt{Ln}+Ln^2) for line 3. Choosing L=⌈n⌉L=\lceil\sqrt{n}\rceil gives O~(mn3/4+n5/2)\widetilde{O}(mn^{3/4}+n^{5/2}), which is the bound of Lemma 9.

Algorithm 4: Preprocessing distance computation with one failure off π\pi

  1. dist⁡H∖e′(r,∗)←MSRP⁡(H,R)\operatorname{dist}_{H\setminus e'}(r,\ast) \gets\operatorname{MSRP}(H,\mathcal{R}) for each r∈Rr \in\mathcal{R} and each e′∈E(H)e' \in E(H)

  2. dist⁡H∖e′(∗,r)←MSRP⁡(Hrev,R)\operatorname{dist}_{H\setminus e'}(\ast,r) \gets\operatorname{MSRP}(H^{\mathrm{rev}},\mathcal{R}) for each r∈Rr \in\mathcal{R} and each e′∈E(H)e' \in E(H)

  3. dist⁡Hq∖e′(v,∗)←MSRP⁡(Hq,V(γq))\operatorname{dist}_{H_q\setminus e'}(v,\ast) \gets\operatorname{MSRP}(H_q,V(\gamma_q)) for each q≥0q \ge0, v∈V(γq)v \in V(\gamma_q), and e′∈E(Hq)e' \in E(H_q)

Once these distances are available, the overall algorithm is the same as that of § 3: for each failed edge e∈E(π)e \in E(\pi), the value dist⁡G∖{e,e′}(s,t)\operatorname{dist}_{G\setminus\{e,e'\}}(s,t) is the minimum of a pivot candidate and a block candidate, both of which are evaluated by prefix and suffix minima along π\pi. The only difference is in the treatment of the second failed edge e′e', which lies off π\pi: the two candidates are defined with the distances in H∖e′H \setminus e' and Hq∖e′H_q \setminus e' in place of those in HH and HqH_q, and they are evaluated for every e′∈E(ρe)∖E(π)e' \in E(\rho_e) \setminus E(\pi). The overall algorithm and its running time are described in Section A.

Both Failures on

In the previous work by Chechik and Zhang [11], the running time in this case is O~(n3−1/7)\widetilde{O}(n^{3-1/7}). In this paper, we propose an algorithm in O~(n11/4)\widetilde{O}(n^{11/4}) time for this case.

Lemma 12 (Both failures on π\pi). All values of dist⁡G∖{e,e′}(s,t)\operatorname{dist}_{G\setminus\{e,e'\}}(s,t) with e,e′∈E(π)e,e' \in E(\pi) can be computed with high probability in O~(n3−1/4)\widetilde{O}(n^{3-1/4}) time.

In this case, we also use the modulo-layer hitting set and the modulo-layer decomposition (§ 3.1) without any change. As in § 3 and Algorithm 1, we partition π\pi into consecutive blocks γ0,γ1,…\gamma_0,\gamma_1,\ldots. These blocks form a partition of E(π)E(\pi), each block has length O(L)O(L), and there are O(n/L)O(n/L) blocks in total. Throughout this subsection, we set L=⌈n3/4⌉L = \lceil n^{3/4}\rceil.

For each pair of failed edges, we consider the blocks that contain the two failures. For e∈E(γp)e \in E(\gamma_p) and e′∈E(γq)e' \in E(\gamma_q) with p≤qp \le q, we distinguish whether the two failed edges lie in the same block or in different blocks, and handle the two cases separately. The former case (p=qp=q) is discussed in § 4.2.1, and the latter case (p<qp<q) in § 4.2.2.

Rough overview of the case where both failures lie on π\pi. For edge pairs in the same block, we construct for each block an auxiliary weighted directed graph with O(L)O(L) vertices and solve 2-FRP on this graph using Lemma 5. Since there are O(n/L)O(n/L) blocks and each instance can be solved in O~(L3)\widetilde{O}(L^3) time, the total time for this computation is O~(nL2)=O~(n5/2)\widetilde{O}(nL^2)=\widetilde{O}(n^{5/2}). For edge pairs in different blocks, we reduce the problem to O(n/L)=O(n1/4)O(n/L)=O(n^{1/4}) SSRP computations, which take O~(n3−1/4)\widetilde{O}(n^{3-1/4}) time in total.

Edge Pairs in the Same Block

We consider two failures e,e′∈E(π)e,e' \in E(\pi) that lie on the same block, that is, ei,ej∈E(γq)e_i,e_j \in E(\gamma_q) for some qq. Our approach builds a weighted kernel on the vertex set V(γq)∪{s′,t′}V(\gamma_q)\cup\{s',t'\}, where s′s' and t′t' are two new vertices, so that KqK_q has at most L+3L+3 vertices and dist⁡Kq∖{e,e′}(s′,t′)=dist⁡G∖{e,e′}(s,t)\operatorname{dist}_{K_q\setminus\{e,e'\}}(s',t')=\operatorname{dist}_{G\setminus\{e,e'\}}(s,t) for every pair e,e′∈E(γq)e,e' \in E(\gamma_q).

Kernel construction. The kernel KqK_q is obtained by adding the following weighted edges (see Figure 3):

Construction of the kernel $K_q$ for edge pairs in the same block

Figure 3. Construction of the kernel KqK_q for edge pairs in the same block. In (a), the black path is π\pi and γq\gamma_q is its subpath between the separator layers hq−1h_{q-1} and hqh_q (shaded). Each colored path of GG becomes a kernel edge of the same length in (b): the blue path from ss, the red path to tt, and the purple ss–tt path avoid E(γq)E(\gamma_q) (Types 2, 3, and 5), and the yellow and green detours are the two terms of Lemma 14 (Type 4), where a yellow detour stays inside HqH_q and a green detour passes through a pivot on a separator layer, in either direction along π\pi. In (b), only the edges of γq\gamma_q (weight one) can fail, and only a few weighted edges are drawn.

Type 1: every edge of γq\gamma_q of weight 1

Type 2: an edge (s′,v)(s',v) of weight dist⁡G∖E(γq)(s,v)\operatorname{dist}_{G\setminus E(\gamma_q)}(s,v) for each v∈V(γq)v \in V(\gamma_q)

Type 3: an edge (v,t′)(v,t') of weight dist⁡G∖E(γq)(v,t)\operatorname{dist}_{G\setminus E(\gamma_q)}(v,t) for each v∈V(γq)v \in V(\gamma_q)

Type 4: an edge (va,vb)(v_a,v_b) of weight dist⁡H(va,vb)\operatorname{dist}_{H}(v_a,v_b) for each va,vb∈V(γq)v_a,v_b \in V(\gamma_q)

Type 5: an edge (s′,t′)(s',t') of weight dist⁡G∖E(γq)(s,t)\operatorname{dist}_{G\setminus E(\gamma_q)}(s,t)

Edges of infinite weight are omitted, and an edge of Type 4 is kept distinct from a parallel edge of γq\gamma_q. The following lemma shows that the kernel is correct.

Lemma 13. For each q≥0q \ge0 and each two failed edges e,e′∈E(γq)e,e' \in E(\gamma_q),

dist⁡Kq∖{e,e′}(s′,t′)=dist⁡G∖{e,e′}(s,t).\operatorname{dist}_{K_q\setminus\{e,e'\}}(s',t')=\operatorname{dist}_{G\setminus\{e,e'\}}(s,t).

Proof. Every edge of Kq∖{e,e′}K_q \setminus\{e,e'\} expands to a walk of the same length in G∖{e,e′}G \setminus\{e,e'\}. Therefore, dist⁡Kq∖{e,e′}(s′,t′)\operatorname{dist}_{K_q\setminus\{e,e'\}}(s',t') is at least dist⁡G∖{e,e′}(s,t)\operatorname{dist}_{G\setminus\{e,e'\}}(s,t).

For the converse inequality, let ρ\rho be a canonical shortest ss–tt path of G∖{e,e′}G \setminus\{e,e'\} with respect to π\pi and {e,e′}\{e,e'\} (Definition 6). It suffices to find an s′s'–t′t' walk of Kq∖{e,e′}K_q \setminus\{e,e'\} of length at most ∣ρ∣|\rho|. If ρ\rho uses no edge of γq\gamma_q, then ρ\rho is a path of G∖E(γq)G \setminus E(\gamma_q), and the edge (s′,t′)(s',t') of Type 5 has weight at most ∣ρ∣|\rho|.

Otherwise, let (vi,vi+1)(v_i,v_{i+1}) and (vi′,vi+1′)(v'_{i},v'_{i+1}) be the first and the last edge of γq\gamma_q on ρ\rho, and split ρ\rho into the prefix ρ[s,vi]\rho[s,v_i], the middle part ρ[vi,vi+1′]\rho[v_i,v'_{i+1}], and the suffix ρ[vi+1′,t]\rho[v'_{i+1},t]. The prefix and the suffix use no edge of γq\gamma_q, so they are paths of G∖E(γq)G \setminus E(\gamma_q), and their lengths are at least the weights of the edge (s′,vi)(s',v_i) of Type 2 and the edge (vi+1′,t′)(v'_{i+1},t') of Type 3, respectively. Since ρ\rho is canonical and both failures lie on γq\gamma_q, the middle part uses no edge of π\pi outside γq\gamma_q. Hence the middle part decomposes into edges of γq\gamma_q and maximal subpaths of HH. Every edge of γq\gamma_q on ρ\rho is different from ee and e′e', so it is an edge of Type 1 of Kq∖{e,e′}K_q \setminus\{e,e'\}. Every maximal subpath of HH starts at viv_i or at the head of an edge of γq\gamma_q and ends at vi+1′v'_{i+1} or at the tail of an edge of γq\gamma_q; hence it connects two vertices va,vb∈V(γq)v_a,v_b \in V(\gamma_q), and its length is at least dist⁡H(va,vb)\operatorname{dist}_{H}(v_a,v_b), the weight of the edge (va,vb)(v_a,v_b) of Type 4. Replacing the prefix, the suffix, and every piece of the middle part by the corresponding kernel edge yields an s′s'–t′t' walk of Kq∖{e,e′}K_q \setminus\{e,e'\} of length at most ∣ρ∣|\rho|, which proves the converse inequality.

By the above lemma, the algorithm of Lemma 5 answers all pairs of the block in O~(L3)\widetilde{O}(L^3) time, and all O(n/L)O(n/L) blocks in O~(nL2)\widetilde{O}(nL^2) time.

To construct the kernels, their edge weights have to be computed in a preprocessing step. The weights of Types 2, 3, and 5 are obtained by one forward and one reverse BFS in G∖E(γq)G \setminus E(\gamma_q) per block, in O(mn/L)O(mn/L) time in total. The delicate part is the weights of Type 4, that is, the detour distances dist⁡H(va,vb)\operatorname{dist}_{H}(v_a,v_b) for va,vb∈V(γq)v_a,v_b \in V(\gamma_q). A canonical replacement path for dual failures may also contain a backward detour, from vav_a to vbv_b with b<ab<a. Backward detours are not intercepted by RR: the argument of Lemma 8 relies on the fact that a path climbing from layer aa to layer b>ab>a visits every layer in between, whereas a path descending from layer aa to layer b<ab<a may skip all separator layers in between. This is why we restrict the kernel to pairs inside one block: a detour between two vertices of the same block either stays within the layers of the block or leaves them and must climb back in through a separator layer, so the decomposition of Lemma 8 survives regardless of the order of aa and bb.

Lemma 14. For each q≥0q \ge0 and each hq−1≤a,b≤hqh_{q-1} \le a,b \le h_q,

dist⁡H(va,vb)=min⁡{min⁡r∈R{dist⁡H(va,r)+dist⁡H(r,vb)},dist⁡Hq(va,vb)}.\operatorname{dist}_{H}(v_a,v_b)=\min\left\{\min_{r\in R}\left\{\operatorname{dist}_{H}(v_a,r)+\operatorname{dist}_{H}(r,v_b)\right\},\operatorname{dist}_{H_q}(v_a,v_b)\right\}.

Proof. The proof of Lemma 8 applies verbatim: it uses the order of aa and bb only to guarantee dist⁡G(s,vb)≥hq−1\operatorname{dist}_{G}(s,v_b) \ge h_{q-1}, which now holds by assumption. □

The distances dist⁡H(va,r)\operatorname{dist}_{H}(v_a,r) and dist⁡H(r,vb)\operatorname{dist}_{H}(r,v_b) for all pivots rr are obtained by a forward and a reverse BFS in HH from each of the ∣R∣≤n/L|R| \le n/L pivots, in O(mn/L)O(mn/L) time, and the distances dist⁡Hq(va,vb)\operatorname{dist}_{H_q}(v_a,v_b) by a BFS in HqH_q from each of the at most L+1L+1 vertices of γq\gamma_q; since every vertex and every edge of HH lies in at most two of the graphs HqH_q, these BFSs cost O(mL)O(mL) time in total. Evaluating the minimum of Lemma 14 for the at most L2L^2 pairs of a block takes O(L2⋅n/L)=O(nL)O(L^2 \cdot n/L)=O(nL) time, hence O(n2)O(n^2) time over all O(n/L)O(n/L) blocks. Together with the O~(nL2)\widetilde{O}(nL^2) time for running the algorithm of Lemma 5 on every kernel, all edge pairs in the same block are handled deterministically in O~(mL+mn/L+n2+nL2)=O~(mn3/4+n5/2)\widetilde{O}(mL+mn/L+n^2+nL^2)=\widetilde{O}(mn^{3/4}+n^{5/2}) time, recalling that L=⌈n3/4⌉L=\lceil n^{3/4}\rceil. The whole procedure is summarized in Algorithm 5.

Algorithm 5: Edge pairs in the same block

  1. dist⁡H(r,∗)←BFS⁡(H,r)\operatorname{dist}_{H}(r,*) \leftarrow\operatorname{BFS}(H,r) for each r∈Rr \in R

  2. dist⁡H(∗,r)←BFS⁡(Hrev,r)\operatorname{dist}_{H}(*,r) \leftarrow\operatorname{BFS}(H^{\mathrm{rev}},r) for each r∈Rr \in R

  3. foreach block qq do

  4. dist⁡G∖E(γq)(s,∗)←BFS⁡(G∖E(γq),s)\operatorname{dist}_{G\setminus E(\gamma_q)}(s,*) \leftarrow\operatorname{BFS}(G\setminus E(\gamma_q),s)

  5. dist⁡G∖E(γq)(∗,t)←BFS⁡((G∖E(γq))rev,t)\operatorname{dist}_{G\setminus E(\gamma_q)}(*,t) \leftarrow\operatorname{BFS}((G\setminus E(\gamma_q))^{\mathrm{rev}},t)

  6. dist⁡Hq(v,∗)←BFS⁡(Hq,v)\operatorname{dist}_{H_q}(v,*) \leftarrow\operatorname{BFS}(H_q,v) for each v∈V(γq)v \in V(\gamma_q)

  7. foreach va,vb∈V(γq)v_a,v_b \in V(\gamma_q) do

  8. dist⁡H(va,vb)←min⁡{min⁡r∈R{dist⁡H(va,r)+dist⁡H(r,vb)},dist⁡Hq(va,vb)}\operatorname{dist}_{H}(v_a,v_b) \leftarrow\min\left\{\min_{r\in R}\{\operatorname{dist}_{H}(v_a,r)+\operatorname{dist}_{H}(r,v_b)\},\operatorname{dist}_{H_q}(v_a,v_b)\right\}

  9. Construct the weighted kernel KqK_q by the procedure described in Kernel construction

  10. Run the algorithm of Lemma 5 for KqK_q and s′,t′s',t'.

Edge Pairs in Different Blocks

Fix two distinct blocks γp=π[va,vb]\gamma_p=\pi[v_a,v_b] and γq=π[vc,vd]\gamma_q=\pi[v_c,v_d], where p+1≤qp+1\le q and hence b≤cb\le c. Let e=(vi,vi+1)∈E(γp)e=(v_i,v_{i+1})\in E(\gamma_p) and e′=(vj,vj+1)∈E(γq)e'=(v_j,v_{j+1})\in E(\gamma_q), so that a≤i<b≤c≤j<da\le i<b\le c\le j<d.

Let ρ\rho be a canonical shortest ss–tt path in G∖{e,e′}G\setminus\{e,e'\}. Such a path always exists. We distinguish four cases according to how ρ\rho traverses the portions of π\pi around the two failed edges. See Figure 4 for an illustration.

The four cases for a canonical shortest path

Figure 4. The four cases for a canonical shortest ss–tt path ρ\rho in G∖{e,e′}G \setminus\{e,e'\}. The blue curve represents ρ\rho. The figure is schematic, and ρ\rho may still intersect π\pi at other vertices.

Case 1: ρ\rho does not use any edge of π[vi+1,vb]\pi[v_{i+1},v_b].

Case 2: ρ\rho does not use any edge of π[vc,vj]\pi[v_c,v_j].

Case 3: Neither Case 1 nor Case 2 occurs. Let xx be the minimum index such that vx∈V(π[vi+1,vb])∩V(ρ)v_x \in V(\pi[v_{i+1},v_b]) \cap V(\rho), and let yy be the maximum index such that vy∈V(π[vc,vj])∩V(ρ)v_y \in V(\pi[v_c,v_j]) \cap V(\rho). Note that such vertices vxv_x and vyv_y necessarily exist, since neither Case 1 nor Case 2 occurs. Suppose that vxv_x appears at or before vyv_y on ρ\rho. Since x≤b≤c≤yx \le b \le c \le y, we have vx=vyv_x = v_y only if b=cb = c and x=y=bx = y = b, which can happen when q=p+1q = p + 1.

Case 4: Neither Case 1 nor Case 2 occurs, and, with vxv_x and vyv_y defined as in Case 3, vyv_y appears strictly before vxv_x on ρ\rho.

For every pair of edges (e,e′)(e,e') in different blocks, let DL(e,e′)D_L(e,e'), DR(e,e′)D_R(e,e'), DF(e,e′)D_F(e,e'), and DB(e,e′)D_B(e,e') denote the minimum lengths of ss–tt paths in G∖{e,e′}G \setminus\{e,e'\} satisfying the conditions of Cases 1, 2, 3, and 4, respectively. Then,

dist⁡G∖{e,e′}(s,t)=min⁡{DL(e,e′),DR(e,e′),DF(e,e′),DB(e,e′)}.\operatorname{dist}_{G\setminus\{e,e'\}}(s,t)=\min\{D_L(e,e'),D_R(e,e'),D_F(e,e'),D_B(e,e')\}.

We next describe how to compute these candidates efficiently. Roughly speaking, we show that all of them can be obtained using only O(n/L)O(n/L) SSRP computations.

Case 1: ρ\rho contains no edge of π[vi+1,vb]\pi[v_{i+1},v_b]. Let vzv_z be the last vertex of ρ\rho in {v0,…,vi}\{v_0,\ldots,v_i\}. Since π[s,vz]\pi[s,v_z] contains no failed edge, the canonicality of ρ\rho implies that ρ[s,vz]=π[s,vz]\rho[s,v_z]=\pi[s,v_z], and hence ∣ρ[s,vz]∣=z|\rho[s,v_z]|=z. Moreover, ρ[vz,t]\rho[v_z,t] contains no edge of γp\gamma_p. Indeed, by the choice of vzv_z, it cannot use an edge of π[va,vi]\pi[v_a,v_i], the edge ee is failed, and by the assumption of this case it uses no edge of π[vi+1,vb]\pi[v_{i+1},v_b]. Therefore, we have ∣ρ∣=z+dist⁡G∖(E(γp)∪{e′})(vz,t)|\rho|=z+\operatorname{dist}_{G\setminus(E(\gamma_p)\cup\{e'\})}(v_z,t).

Accordingly, define

DL(e,e′):=min⁡0≤z≤i{z+dist⁡G∖(E(γp)∪{e′})(vz,t)}.D_L(e,e'):=\min_{0\le z\le i}\left\{z+\operatorname{dist}_{G\setminus(E(\gamma_p)\cup\{e'\})}(v_z,t)\right\}.

Every term in the minimum corresponds to an ss–tt walk avoiding both ee and e′e', while the choice of vzv_z above attains ∣ρ∣|\rho|. Hence, ∣ρ∣=DL(e,e′)|\rho|=D_L(e,e') in this case.

Computing DLD_L. For each block γp\gamma_p, let Gp:=G∖E(γp)G_p:=G\setminus E(\gamma_p) and run SSRP from tt in GprevG_p^{\mathrm{rev}}. This gives, for every failed edge e′e' and every vertex vzv_z, the distance dist⁡Gp∖e′(vz,t)\operatorname{dist}_{G_p\setminus e'}(v_z,t). For each fixed e′e', we then scan the vertices v0,v1,…v_0, v_1, \ldots in their order on π\pi and maintain the prefix minima Pe′(i):=min⁡0≤z≤i{z+dist⁡GP∖e′(vz,t)}P_{e'}(i) := \min_{0 \le z \le i} \{z + \operatorname{dist}_{G_{P}\setminus e'}(v_z,t)\}. Then, for every e=(vi,vi+1)∈E(γp)e = (v_i,v_{i+1}) \in E(\gamma_p), we simply have DL(e,e′)=Pe′(i)D_L(e,e') = P_{e'}(i).

Running time. There are O(n/L)O(n/L) blocks. By Lemma 4, one call to SSRP takes O~(mn+n2)\widetilde{O}(m\sqrt{n} + n^2) time. Hence, the total time for the SSRP calls over all blocks is O~(nL(mn+n2))=O~((mn3/2+n3)/L)\widetilde{O}\left(\frac{n}{L}(m\sqrt{n} + n^2)\right) = \widetilde{O}\left((mn^{3/2} + n^3)/L\right). Recall that there are only O(n)O(n) possible choices for the second failed edge e′e'. The prefix-minimum scans require at most O(n2)O(n^2) additional time per block, and hence O(n3/L)O(n^3/L) time over all blocks. Consequently, all values DL(e,e′)D_L(e,e') for edge pairs (e,e′)(e,e') lying in different blocks can be computed in O~((mn3/2+n3)/L)\widetilde{O}\left((mn^{3/2} + n^3)/L\right) time.

Case 2: ρ\rho contains no edge of π[vc,vj]\pi[v_c,v_j]. This case is symmetric to Case 1. Let vzv_z be the first vertex of ρ\rho in {vj+1,…,vk}\{v_{j+1},\ldots,v_k\}. By canonicality, ρ[vz,t]=π[vz,t]\rho[v_z,t] = \pi[v_z,t], and hence ∣ρ[vz,t]∣=k−z|\rho[v_z,t]| = k-z. Moreover, ρ[s,vz]\rho[s,v_z] contains no edge of γq\gamma_q. Therefore, we define

DR(e,e′):=min⁡j<z≤k{dist⁡G∖(E(γq)∪{e})(s,vz)+(k−z)}.D_R(e,e') := \min_{j<z\le k} \{\operatorname{dist}_{G\setminus(E(\gamma_q)\cup\{e\})}(s,v_z) + (k-z)\}.

Every term in the minimum corresponds to an ss–tt walk avoiding both ee and e′e', while the choice of vzv_z above attains ∣ρ∣|\rho|. Hence, we have ∣ρ∣=DR(e,e′)|\rho| = D_R(e,e') in Case 2. To compute these values, for each block γq\gamma_q, we run SSRP from ss in G∖E(γq)G\setminus E(\gamma_q). For each fixed failed edge ee, a suffix-minimum scan along π\pi then gives DR(e,e′)D_R(e,e') for every e′=(vj,vj+1)∈E(γq)e'=(v_j,v_{j+1})\in E(\gamma_q). As in Case 1, all values DR(e,e′)D_R(e,e') can be computed in O~((mn3/2+n3)/L)\widetilde{O}((mn^{3/2}+n^3)/L) time.

Case 3: vxv_x appears at or before vyv_y on ρ\rho. Since neither Case 1 nor Case 2 occurs, the vertices vxv_x and vyv_y are well defined. Recall that xx is the minimum index such that vx∈V(π[vi+1,vb])∩V(ρ)v_x \in V(\pi[v_{i+1},v_b])\cap V(\rho), and yy is the maximum index such that vy∈V(π[vc,vj])∩V(ρ)v_y \in V(\pi[v_c,v_j])\cap V(\rho). Thus, i<x≤b≤c≤y≤ji < x \le b \le c \le y \le j. Hence, π[vx,vy]\pi[v_x,v_y] contains neither ee nor e′e'. Since vxv_x appears at or before vyv_y on both π\pi and ρ\rho, the canonicality of ρ\rho implies that ρ[vx,vy]=π[vx,vy]\rho[v_x,v_y] = \pi[v_x,v_y].

Moreover, ρ[s,vb]\rho[s,v_b] uses no edge of π[vb,t]\pi[v_b,t], and ρ[vc,t]\rho[v_c,t] uses no edge of π[s,vc]\pi[s,v_c]. Therefore, ρ[s,vb]\rho[s,v_b] uses only edges of G∖E(π[vb,t])=H+π[s,vb]G\setminus E(\pi[v_b,t]) = H+\pi[s,v_b] and avoids ee. Recall that H:=G∖E(π)H := G\setminus E(\pi). Similarly, ρ[vc,t]\rho[v_c,t] uses only edges of G∖E(π[s,vc])=H+π[vc,t]G\setminus E(\pi[s,v_c]) = H+\pi[v_c,t] and avoids e′e'.

Accordingly, define

DF(e,e′):=dist⁡(H+π[s,vb])∖e(s,vb)+(c−b)+dist⁡(H+π[vc,t])∖e′(vc,t).D_F(e,e') := \operatorname{dist}_{(H+\pi[s,v_b])\setminus e}(s,v_b) + (c-b) + \operatorname{dist}_{(H+\pi[v_c,t])\setminus e'}(v_c,t).

In Case 3, we have ∣ρ∣=DF(e,e′)|\rho| = D_F(e,e'). The key observation is that e′e' is absent from H+π[s,vb]H+\pi[s,v_b], while ee is absent from H+π[vc,t]H+\pi[v_c,t]. Hence, each of the two distance terms in DF(e,e′)D_F(e,e') involves only one failed edge.

Computing DFD_F and its running time. For every block γp=π[va,vb]\gamma_p = \pi[v_a,v_b], run SSRP from ss in H+π[s,vb]H+\pi[s,v_b]. This gives dist⁡(H+π[s,vb])∖e(s,vb)\operatorname{dist}_{(H+\pi[s,v_b])\setminus e}(s,v_b) for every e∈E(γp)e \in E(\gamma_p). Symmetrically, for every block γq=π[vc,vd]\gamma_q = \pi[v_c,v_d], run SSRP from tt in (H+π[vc,t])rev(H+\pi[v_c,t])^{\mathrm{rev}}. This gives dist⁡(H+π[vc,t])∖e′(vc,t)\operatorname{dist}_{(H+\pi[v_c,t])\setminus e'}(v_c,t) for every e′∈E(γq)e' \in E(\gamma_q). Once these values are available, DF(e,e′)D_F(e,e') can be obtained in constant time for every pair (e,e′)(e,e').

There are O(n/L)O(n/L) blocks, and each SSRP call takes O~(mn+n2)\widetilde{O}(m\sqrt{n}+n^2) time by Lemma 4. Hence, all values DF(e,e′)D_F(e,e') can be computed in O~((mn3/2+n3)/L)\widetilde{O}((mn^{3/2}+n^3)/L) time, together with O(n2)O(n^2) additional time to compute DF(e,e′)D_F(e,e') for all edge pairs (e,e′)(e,e').

Case 4: vyv_y appears strictly before vxv_x on ρ\rho. Let Sp:={u∈V∣dist⁡G(s,u)=b}S_p := \{u \in V \mid\operatorname{dist}_G(s,u) = b\} and Tq:={w∈V∣dist⁡G(s,w)=c}T_q := \{w \in V \mid\operatorname{dist}_G(s,w) = c\}. Let uu be the first vertex of ρ\rho in SpS_p, and let ww be the last vertex of ρ\rho in TqT_q. See Figure 5 for an illustration.

A canonical shortest $s$–$t$ path $\rho$ in $G \setminus \{e,e'\}$ in Case 4

Figure 5. A canonical shortest ss–tt path ρ\rho in G∖{e,e′}G \setminus\{e,e'\} in Case 4. The blue curve represents ρ\rho.

By the choice of uu, the prefix ρ[s,u]\rho[s,u] contains no edge of π[vb,t]\pi[v_b,t]. This is because every vertex of ρ[s,u)\rho[s,u) has distance from ss strictly less than bb. Similarly, by the choice of ww, the suffix ρ[w,t]\rho[w,t] contains no edge of π[s,vc]\pi[s,v_c]. Define

Ae(u):=dist⁡(H+π[s,vb])∖e(s,u),Be′(w):=dist⁡(H+π[vc,t])∖e′(w,t).A_e(u) := \operatorname{dist}_{(H+\pi[s,v_b])\setminus e}(s,u), \qquad B_{e'}(w) := \operatorname{dist}_{(H+\pi[v_c,t])\setminus e'}(w,t).

We next consider the middle portion ρ[u,w]\rho[u,w]. Let vfv_f be the first vertex of ρ[u,w]\rho[u,w] in π[vi+1,vb]\pi[v_{i+1},v_b], and let vgv_g be the last vertex of ρ[u,w]\rho[u,w] in π[vc,vj]\pi[v_c,v_j]. Such vertices exist since ρ[u,w]\rho[u,w] contains both vxv_x and vyv_y.

To analyze the two subpaths ρ[u,vf]\rho[u,v_f] and ρ[vg,w]\rho[v_g,w], we first establish the following claim.

Claim 15. Every vertex vr∈V(π)∩V(ρ[u,w])v_r \in V(\pi) \cap V(\rho[u,w]) satisfies i+1≤r≤ji+1 \le r \le j.

Proof. Suppose first that ρ[u,w]\rho[u,w] visits some vrv_r with r≤ir \le i. Since π[s,vr]\pi[s,v_r] contains no failed edge, canonicity implies ρ[s,vr]=π[s,vr]\rho[s,v_r] = \pi[s,v_r]. However, ρ[s,vr]\rho[s,v_r] contains uu, while dist⁡G(s,u)=b>r\operatorname{dist}_G(s,u) = b > r, a contradiction.

Similarly, if ρ[u,w]\rho[u,w] visits some vrv_r with r≥j+1r \ge j+1, then π[vr,t]\pi[v_r,t] contains no failed edge, and canonicity implies ρ[vr,t]=π[vr,t]\rho[v_r,t] = \pi[v_r,t]. Since ρ[vr,t]\rho[v_r,t] contains ww, this would imply w∈V(π[vr,t])w \in V(\pi[v_r,t]). However, every vertex on π[vr,t]\pi[v_r,t] has distance at least rr from ss, whereas dist⁡G(s,w)=c<r\operatorname{dist}_G(s,w) = c < r, a contradiction. □\square

By Claim 15 and the choice of vfv_f, the subpath ρ[u,vf]\rho[u,v_f] contains no edge of π[s,vb]\pi[s,v_b]. Indeed, otherwise it would use some edge (vr,vr+1)(v_r,v_{r+1}) with i+1≤r<bi+1 \le r < b, and hence visit a vertex of π[vi+1,vb]\pi[v_{i+1},v_b] before vfv_f, contradicting the choice of vfv_f. Similarly, by Claim 15 and the choice of vgv_g, the subpath ρ[vg,w]\rho[v_g,w] contains no edge of π[vc,t]\pi[v_c,t]. Hence, ρ[u,vf]⊆H+π[vb,t]\rho[u,v_f] \subseteq H+\pi[v_b,t] and ρ[vg,w]⊆H+π[s,vc]\rho[v_g,w] \subseteq H+\pi[s,v_c].

Now, define

Ue′u(f):=dist⁡(H+π[vb,t])∖e′(u,vf),Vew(g):=dist⁡(H+π[s,vc])∖e(vg,w).U_{e'}^{u}(f) := \operatorname{dist}_{(H+\pi[v_b,t])\setminus e'}(u,v_f), \qquad V_e^{w}(g) := \operatorname{dist}_{(H+\pi[s,v_c])\setminus e}(v_g,w).

There are two cases depending on the order of vfv_f and vgv_g on ρ\rho.

Case 4.1: vgv_g appears at or before vfv_f on ρ\rho. In this case, vfv_f lies on ρ[vg,w]\rho[v_g,w], and hence the middle portion ρ[u,w]\rho[u,w] can be split at vfv_f into ρ[u,vf]\rho[u,v_f] and ρ[vf,w]\rho[v_f,w]. In this case, we decompose ρ[u,w]\rho[u,w] as ρ[u,vf]∘ρ[vf,w]\rho[u,v_f] \circ\rho[v_f,w]. Accordingly, define

Me,e′u,w:=min⁡i+1≤f≤b{Ue′u(f)+Vew(f)}.M_{e,e'}^{u,w} := \min_{i+1 \le f \le b} \left\{ U_{e'}^{u}(f) + V_e^{w}(f) \right\}.

Case 4.2: vfv_f appears before vgv_g on ρ\rho. Since i+1≤f≤b≤c≤g≤ji+1 \le f \le b \le c \le g \le j the subpath π[vf,vg]\pi[v_f,v_g] contains neither failed edge. By canonicality, ρ[vf,vg]=π[vf,vg]\rho[v_f,v_g] = \pi[v_f,v_g]. Thus, the two middle portions ρ[u,vf]\rho[u,v_f] and ρ[vg,w]\rho[v_g,w] are connected by the subpath π[vf,vg]\pi[v_f,v_g]. In this case, we decompose ρ[u,w]\rho[u,w] as ρ[u,vf]∘π[vf,vg]∘ρ[vg,w]\rho[u,v_f] \circ\pi[v_f,v_g] \circ\rho[v_g,w]. Accordingly, define

Ce,e′u,w:=min⁡i+1≤f≤bc≤g≤j{Ue′u(f)+(g−f)+Vew(g)}=min⁡i+1≤f≤b{Ue′u(f)−f}+min⁡c≤g≤j{g+Vew(g)}.\begin{aligned} C_{e,e'}^{u,w} := \min_{\substack{i+1\le f\le b\\c\le g\le j}} \left\{U_{e'}^u(f) + (g-f) + V_e^w(g)\right\} \\ &= \min_{i+1\le f\le b}\left\{U_{e'}^u(f)-f\right\} + \min_{c\le g\le j}\left\{g+V_e^w(g)\right\}. \end{aligned}

Combining Cases 4.1 and 4.2. Accordingly, define

DB(e,e′):=min⁡u∈Sp,w∈Tq{Ae(u)+min⁡{Me,e′u,w,Ce,e′u,w}+Be′(w)}.D_{\mathrm{B}}(e,e') := \min_{u\in S_p,w\in T_q}\left\{A_e(u)+\min\left\{M_{e,e'}^{u,w},C_{e,e'}^{u,w}\right\}+B_{e'}(w)\right\}.

Every term in the minimum corresponds to an ss–tt walk in G∖{e,e′}G\setminus\{e,e'\}. Conversely, the canonical path ρ\rho determines suitable vertices u,w,f,gu,w,f,g, and hence one of the above terms has length ∣ρ∣|\rho|. Therefore, in Case 4, we have ∣ρ∣=DB(e,e′)|\rho|=D_{\mathrm{B}}(e,e').

Computing AA, BB, UU, and VV. All required values AA, BB, UU, and VV can all be computed using SSRP. For each block γp=π[va,vb]\gamma_p=\pi[v_a,v_b], we run SSRP from ss in H+π[s,vb]H+\pi[s,v_b] to compute all values Ae(u)A_e(u). Similarly, for each block γq=π[vc,vd]\gamma_q=\pi[v_c,v_d], we run SSRP from tt in (H+π[vc,t])rev(H+\pi[v_c,t])^{\mathrm{rev}} to compute all values Be′(w)B_{e'}(w).

For each vertex u∈Spu\in S_p, we run SSRP from uu in H+π[vb,t]H+\pi[v_b,t] to compute all values Ueu(z)U_e^u(z). Similarly, for each vertex w∈Tqw\in T_q, we run SSRP from ww in (H+π[s,vc])rev(H+\pi[s,v_c])^{\mathrm{rev}} to compute all values Vew(z)V_e^w(z).

By Lemma 4, one call to SSRP takes O~(mn+n2)\widetilde{O}(m\sqrt{n}+n^2) time. There are O(n/L)O(n/L) blocks, and by the definition of the modulo-layer hitting set, we have ∑p∣Sp∣=O(n/L)\sum_p |S_p|=O(n/L) and ∑q∣Tq∣=O(n/L)\sum_q |T_q|=O(n/L). Hence, the total number of SSRP calls is O(n/L)O(n/L). Therefore, all required values AA, BB, UU, and VV can be computed in O~((mn3/2+n3)/L)\widetilde{O}((mn^{3/2}+n^3)/L) time.

Computing DBD_{\mathrm{B}}. Fix u∈Spu\in S_p and w∈Tqw\in T_q. There are O(L)O(L) possible choices for e∈E(γp)e\in E(\gamma_p) and O(L)O(L) possible choices for e′∈E(γq)e'\in E(\gamma_q). For each fixed pair (e,e′)(e,e'), the value Me,e′u,wM_{e,e'}^{u,w} can be computed by scanning the O(L)O(L) possible indices ff. Similarly, each of min⁡i+1≤f≤b{Ue′u(f)−f}\min_{i+1\le f\le b}\{U_{e'}^u(f)-f\} and min⁡c≤g≤j{g+Vew(g)}\min_{c\le g\le j}\{g+V_e^w(g)\} can be computed in O(L)O(L) time. Hence, Ce,e′u,wC_{e,e'}^{u,w} can also be computed in O(L)O(L) time. Therefore, all required values Me,e′u,wM_{e,e'}^{u,w} and Ce,e′u,wC_{e,e'}^{u,w} for the fixed pair (u,w)(u,w) can be computed in O(L3)O(L^3) time.

The total number of pairs (u,w)(u,w) over all pairs of blocks is at most

∑p<q∣Sp∣∣Tq∣≤(∑p∣Sp∣)(∑q∣Tq∣)=O(n2L2).\sum_{p<q}|S_p||T_q|\le\left(\sum_p|S_p|\right)\left(\sum_q|T_q|\right)=O\left(\frac{n^2}{L^2}\right).

Consequently, the total time for computing all values Me,e′u,wM_{e,e'}^{u,w} and Ce,e′u,wC_{e,e'}^{u,w} is O(n2L2⋅L3)=O(n2L)O\left(\frac{n^2}{L^2}\cdot L^3\right)=O(n^2L).

Finally, all values DB(e,e′)D_{\mathrm{B}}(e,e') can be computed in O~(mn3/2+n3L+n2L)\widetilde{O}\left(\frac{mn^{3/2}+n^3}{L}+n^2L\right) time.

Total running time. From Cases 1–4, all values DL(e,e′)D_{\mathrm{L}}(e,e'), DR(e,e′)D_{\mathrm{R}}(e,e'), DF(e,e′)D_{\mathrm{F}}(e,e'), DB(e,e′)D_{\mathrm{B}}(e,e') can be computed in O~(mn3/2+n3L+n2L)\widetilde{O}\left(\frac{mn^{3/2}+n^3}{L}+n^2L\right) time. Therefore, all values dist⁡G∖{e,e′}(s,t)\operatorname{dist}_{G\setminus\{e,e'\}}(s,t) for pairs (e,e′)(e,e') lying in different blocks can be computed in O~((mn3/2+n3)/L+n2L)=O~(n3−1/4)\widetilde{O}\left((mn^{3/2}+n^3)/L+n^2L\right)=\widetilde{O}(n^{3-1/4}) total time, recalling that L=⌈n3/4⌉L=\lceil n^{3/4}\rceil.

Concluding Remarks

In this work, we introduced the modulo-layer hitting set technique and showed that this simple idea is useful for both single-failure and dual-failure replacement paths in unweighted directed graphs. For RP, in particular, it leads to a remarkably simple deterministic algorithm that is suitable for textbook presentation and practical implementation. We believe that this technique may be useful more broadly in other shortest-path problems.

For 2-FRP, the modulo-layer hitting-set technique allows us to solve the problem using MSRP and SSRP as subroutines. Our algorithm can be viewed as a weak form of a reduction from directed 2-FRP to MSRP and SSRP. Roughly speaking, our algorithm reduces directed 2-FRP to a constant number of MSRP instances with O(n)O(\sqrt{n}) sources and O(n1/4)O(n^{1/4}) SSRP instances.

Finally, the only randomization in our 2-FRP algorithm comes from the MSRP algorithm by Harada and Izumi [22]. Thus, a deterministic MSRP algorithm with the same running time as that of Harada and Izumi would immediately yield a deterministic O~(n3−1/4)\widetilde{O}(n^{3-1/4})-time algorithm for 2-FRP.

Acknowledgements. Kaito Harada was supported by JST BOOST, Japan Grant Number JP-MJBS2402.

AI Disclosure. The main ideas behind our RP and 2-FRP algorithms were developed largely with the assistance of GPT-6 Astra (OpenAI). The authors’ contributions include simplifying several of the resulting algorithms, unifying the underlying techniques under the modulo-layer hitting set, developing the idea of using MSRP to improve the running time for 2-FRP when one failed edge lies on π\pi, and the entire design and analysis of the algorithm for this case (Lemma 9). We also used GPT-6 Astra (OpenAI) and Claude Fable 5.1 (Anthropic) to assist with language editing and improving the presentation of parts of the manuscript. All proofs and the text of this paper were written and verified by the authors, who take full responsibility for its content.

One Failure on π\pi

This appendix completes the proof of Lemma 9. We describe the overall algorithm that computes all values dist⁡G∖{e,e′}(s,t)\operatorname{dist}_{G\setminus\{e,e'\}}(s,t) with e∈E(π)e \in E(\pi) and e′∉E(π)e' \notin E(\pi) from the distances of Algorithm 4, and analyze its running time.

Pairs to be computed. Recall from § 4 that ρei\rho_{e_i} denotes a fixed replacement path for ei=(vi,vi+1)∈E(π)e_i=(v_i,v_{i+1})\in E(\pi), and that only the second failures e′∈E(ρei)∖E(π)e'\in E(\rho_{e_i})\setminus E(\pi) need to be considered. Let

K:={(i,e′)∣0≤i<k, e′∈E(ρei)∖E(π)}.\mathcal{K}:=\{(i,e')\mid0\le i<k,\ e'\in E(\rho_{e_i})\setminus E(\pi)\}.

where E(ρei):=∅E(\rho_{e_i}):=\varnothing if eie_i has no replacement path. Then ∣K∣<n2|\mathcal{K}|<n^2, and every pair of K\mathcal{K} has e′∈E(H)e'\in E(H).

Overall algorithm. Consider a pair (i,e′)∈K(i,e')\in\mathcal{K}. Lemmas 10 and 11 are Lemmas 7 and 8 with HH replaced by H∖e′H\setminus e', and the derivation of § 3 applies verbatim to them. Hence

dist⁡G∖{ei,e′}(s,t)=min⁡{Ci(e′),Si(e′)}.\operatorname{dist}_{G\setminus\{e_i,e'\}}(s,t)=\min\{C_i(e'),S_i(e')\}.

where Ci(e′)C_i(e') and Si(e′)S_i(e') are the candidates CiC_i and SiS_i of § 3 with dist⁡H\operatorname{dist}_H and dist⁡Hq(i)\operatorname{dist}_{H_{q(i)}} replaced by dist⁡H∖e′\operatorname{dist}_{H\setminus e'} and dist⁡Hq(i)∖e′\operatorname{dist}_{H_{q(i)}\setminus e'}. Accordingly, let Ae′(r)A^{e'}(r), Be′(r)B^{e'}(r), and Wq,ae′W^{e'}_{q,a} denote the tables that the scans of Algorithm 3 build with these distances; then

Ci(e′)=min⁡r∈R{Aie′(r)+Bie′(r)}andSi(e′)=min⁡hq(i)−1≤a≤i{a+Wq(i),ae′(i)}.C_i(e')=\min_{r\in R}\{A_i^{e'}(r)+B_i^{e'}(r)\} \qquad\text{and}\qquad S_i(e')=\min_{h_{q(i)}-1\le a\le i}\{a+W^{e'}_{q(i),a}(i)\}.

In particular, running lines 2–19 of Algorithm 3 with the distances of H∖e′H\setminus e' computes min⁡{Ci(e′),Si(e′)}\min\{C_i(e'),S_i(e')\} for all ii. Doing so for every e′∈E(H)e'\in E(H) takes O(n2/L+nL)O(n^2/L+nL) time per edge, hence O(mn2/L+mnL)O(mn^2/L+mnL) time in total, which is too slow. The algorithm below avoids this by reusing the scans of Algorithm 3 across different e′e', and by evaluating the candidates only for the pairs of K\mathcal{K}.

Reusing scans. Every scan of Algorithm 3 reads only the distances from a single source uu of Algorithm 4: from rr in HrevH^{\mathrm{rev}} for Ae′(r)A^{e'}(r), from rr in HH for Be′(r)B^{e'}(r), and from vav_a in HqH_q for Wq,ae′W^{e'}_{q,a}. Let TuT_u be the shortest-path tree of uu fixed by the MSRP call (edges of HrevH^{\mathrm{rev}} identified with those of HH), and write TrinT_r^{\mathrm{in}}, TroutT_r^{\mathrm{out}}, and Tq,aT_{q,a} for the three kinds of sources. If e′∉E(Tu)e'\notin E(T_u), removing e′e' does not change the distances from uu (§ 2.3), so the table of uu for e′e' equals the table A(r)A(r), B(r)B(r), or Wq,aW_{q,a} that Algorithm 3 builds for HH, which we call the default table of uu. Hence, for each e′∈E(H)e'\in E(H), the algorithm rebuilds only the tables of the sources uu with e′∈E(Tu)e'\in E(T_u), and lets every other table refer to the default table without copying it. Since TuT_u has at most n−1n-1 edges, each source rebuilds its table for at most n−1n-1 edges e′e'. Over all e′e', the ∣R∣≤n/L|R|\le n/L pivots thus rebuild O(n)O(n) tables of k<nk<n entries each, in O(n3/L)O(n^3/L) time, and the at most L+1L+1 path vertices of a block VqV_q rebuild at most ∣Vq∣−1|V_q|-1 tables of at most LL entries each, in O(nL2)O(nL^2) time since ∑q∣Vq∣≤2n\sum_q|V_q|\le2n. Whether e′=(x,y)e'=(x,y) lies in E(Tu)E(T_u) is decided in O(1)O(1) time by checking whether xx is the parent of yy in TuT_u (or yy of xx for TrinT_r^{\mathrm{in}}), and e′e' can lie in Tq,aT_{q,a} only for the at most two blocks VqV_q that contain both endpoints of e′e'. The decisions thus take O(m(n/L+L))O(m(n/L+L)) time in total, which is dominated by the time of Algorithm 4.

Running time. Line 1 of Algorithm 6 takes O(m)O(m) time for Algorithm 1 and, as computed in § 4, O~(mn/L+n3/L+mnnL+n2L)\widetilde{O}(mn/\sqrt{L}+n^3/L+mn\sqrt{nL}+n^2L) time for Algorithm 4, whose output we store so that every distance is accessed in O(1)O(1) time. Line 2 takes O(n2/L+nL)O(n^2/L+nL) time by § 3, and line 3 takes O(n2)O(n^2) time, since ρei\rho_{e_i} is read off in O(n)O(n) time from a minimizer of min⁡{Ci,Si}\min\{C_i,S_i\} recorded in line 2 and the shortest-path trees of the MSRP calls, as the concatenation of π[s,va]\pi[s,v_a], a shortest vav_a–vbv_b path of HH through a pivot or inside Hq(i)H_{q(i)}, and π[vb,t]\pi[v_b,t]. Over all e′∈E(H)e' \in E(H), lines 5–12 take O(m(n/L+L)+n3/L+nL2)O(m(n/L+L)+n^3/L+nL^2) time by the analysis above, and lines 13–17 take O(n/L+L)O(n/L+L) time per pair of K\mathcal{K}, hence O(n3/L+n2L)O(n^3/L+n^2L) time. Since nL2≤n2LnL^2 \le n^2L, mn/L≤mn/Lmn/L \le mn/\sqrt{L}, and mL≤mnLmL \le m\sqrt{nL}, the total running time is

Algorithm 6: The algorithm for one failure on $\pi$.

Figure 6.

O~(mnL+n3L+mnL+n2L).\widetilde{O}\left(\frac{mn}{\sqrt{L}}+\frac{n^3}{L}+m\sqrt{nL}+n^2L\right).

For L=⌈n⌉L=\lceil\sqrt{n}\rceil, this is O~(mn3/4+n5/2)\widetilde{O}(mn^{3/4}+n^{5/2}), which proves Lemma 9.

References

  1. [1]Noga Alon, Shiri Chechik, and Sarel Cohen. Deterministic combinatorial replacement paths and distance sensitivity oracles. In Proc. of the 46th International Colloquium on Automata, Languages, and Programming (ICALP), pages 12:1–12:14, 2019. doi: 10.4230/LIPIcs.ICALP.2019.12.DOI
  2. [2]Josh Alman, Ran Duan, Virginia Vassilevska Williams, Yinzhan Xu, Zixuan Xu, and Renfei Zhou. More asymmetry yields faster matrix multiplication. In Proc. of the 36th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 2005–2039, 2025. doi:10.1137/1.9781611978322.63.DOI
  3. [3]Amir Abboud, Nick Fischer, Zander Kelley, Shachar Lovett, and Raghu Meka. New graph decompositions and combinatorial Boolean matrix multiplication algorithms. In Proc. of the 56th Annual ACM Symposium on Theory of Computing (STOC), pages 935–943, 2024. doi:10.1145/3618260.3649696.DOI
  4. [4]Josh Alman and Virginia Vassilevska Williams. Truly subquadratic 3sum and truly subcubic apsp via triangles in sparse lopsided graphs, 2026. URL: https://arxiv.org/abs/2610.06783, arXiv:2610.06783.
  5. [5]Aaron Bernstein. A nearly optimal algorithm for approximating replacement paths and k shortest simple paths in general graphs. In Proc. of the 21st annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 742–755. SIAM, 2010. doi:10.1137/1.9781611973075.61.DOI
  6. [6]Aaron Bernstein and David Karger. A nearly optimal oracle for avoiding failed vertices and edges. In Proc. of the 41st Annual ACM Symposium on Theory of Computing (STOC), pages 101–110, 2009. doi:10.1145/1536414.1536431.DOI
  7. [8]Yi-Jun Chang, Yanyu Chen, Dipan Dey, Gopinath Mishra, Hung Thuan Nguyen, and Bryce Sanchez. Optimal distributed replacement paths. In Proc. of the 44th ACM Symposium on Principles of Distributed Computing (PODC), pages 287–298, 2025. doi:10.1145/3732772.3733513.DOI
  8. [9]Shucheng Chi, Ran Duan, Benyu Wang, and Tianle Xie. Undirected 3-fault replacement path in nearly cubic time. In Proc. of the 52nd International Colloquium on Automata, Languages, and Programming (ICALP), pages 57:1–57:20, 2025. doi:10.4230/LIPIcs.ICALP.2025.57.DOI
  9. [10]Shiri Chechik and Moran Nechushtan. Simplifying and unifying replacement paths algorithms in weighted directed graphs. In Proc. of the 47th International Colloquium on Automata, Languages, and Programming (ICALP), pages 29–1. Schloss Dagstuhl–Leibniz-Zentrum für Informatik, 2020. doi:10.4230/LIPIcs.ICALP.2020.29.DOI
  10. [11]Shiri Chechik and Tianyi Zhang. Faster algorithms for dual-failure replacement paths. In Proc. of the 51st International Colloquium on Automata, Languages, and Programming (ICALP), volume 297 of Leibniz International Proceedings in Informatics (LIPIcs), pages 41:1–41:20. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2024. doi:10.4230/LIPIcs.ICALP.2024.41.DOI
  11. [12]Shiri Chechik and Tianyi Zhang. Nearly optimal approximate dual-failure replacement paths. In Proc. of the 2024 Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 2568–2596. SIAM, 2024. doi:10.1137/1.9781611977912.91.DOI
  12. [13]Emilien Dupont, Marvin Eisenberger, Borislav Kozlovskii, Abbas Mehrabian, Francisco J. R. Ruiz, Abigail See, Renfei Zhou, Josh Alman, Virginia Vassilevska Williams, and Matej Balog. Improving the matrix multiplication exponent with modern optimization and AlphaEvolve, 2026. arXiv:2608.16884, doi:10.48550/arXiv.2608.16884.DOI
  13. [14]Dipan Dey and Manoj Gupta. Near optimal dual fault tolerant distance oracle. In Proc. of the 32nd Annual European Symposium on Algorithms (ESA), volume 308, pages 45:1–45:23, 2024. doi:10.4230/LIPIcs.ESA.2024.45.DOI
  14. [15]Ran Duan and Hanlin Ren. Maintaining exact distances under multiple edge failures. In Proc. of the 54th Annual ACM SIGACT Symposium on Theory of Computing, pages 1093–1101, 2022. doi:10.1145/3519935.3520002.DOI
  15. [16]Jeff Erickson and Amir Nayyeri. Computing replacement paths in surface embedded graphs. In Proceedings of the 22nd annual ACM-SIAM symposium on Discrete Algorithms (SODA), pages 1347–1354. SIAM, 2011. doi:10.1137/1.9781611973082.103.DOI
  16. [17]David Eppstein. Finding the k shortest paths. SIAM Journal on computing, 28(2):652–673, 1998. doi:10.1137/S0097539795290477.DOI
  17. [18]Yuval Emek, David Peleg, and Liam Roditty. A near-linear-time algorithm for computing replacement paths in planar directed graphs. ACM Transactions on Algorithms (TALG), 6(4):1–13, 2010. doi:10.1145/1824777.1824784.DOI
  18. [19]Zvi Gotthilf and Moshe Lewenstein. Improved algorithms for the k simple shortest paths and the replacement paths problems. Information Processing Letters, 109(7):352–355, 2009. doi:10.1016/j.ipl.2008.12.015.DOI
  19. [20]Yong Gu and Hanlin Ren. Constructing a distance sensitivity oracle in O(n^2.5794M) time. In Proc. of the 48th International Colloquium on Automata, Languages, and Programming (ICALP), volume 198, pages 76:1–76:20, 2021. doi:10.4230/LIPIcs.ICALP.2021.76.DOI
  20. [21]Fabrizio Grandoni and Virginia Vassilevska Williams. Faster replacement paths and distance sensitivity oracles. ACM Transactions on Algorithms (TALG), 16(1):1–25, 2019. doi:10.1145/3365835.DOI
  21. [22]Kaito Harada and Taisuke Izumi. A simple algorithm for the directed multiple source replacement paths problem, 2026. To appear in SOSA 2027. arXiv:2608.16615, doi:10.48550/arXiv.2608.16615.DOI
  22. [23]Kaito Harada, Naoki Kitamura, Taisuke Izumi, and Toshimitsu Masuzawa. A nearly linear time construction of approximate single-source distance sensitivity oracles. In Proc. of the 32nd Annual European Symposium on Algorithms (ESA), volume 308, pages 65:1–65:18, 2024. doi:10.4230/LIPIcs.ESA.2024.65.DOI
  23. [24]Monika Henzinger, Andrea Lincoln, Stefan Neumann, and Virginia Vassilevska Williams. Conditional Hardness for Sensitivity Problems. In 8th Innovations in Theoretical Computer Science Conference (ITCS 2017), volume 67, pages 26:1–26:31, 2017. doi:10.4230/LIPIcs.ITCS.2017.26.DOI
  24. [25]John Hershberger and Subhash Suri. Vickrey prices and shortest paths: What is an edge worth? In Proc. of the 42nd IEEE symposium on foundations of computer science, pages 252–259. IEEE, 2001. doi:10.1109/SFCS.2001.959899.DOI
  25. [26]John Hershberger, Subhash Suri, and Amit Bhosle. On the difficulty of some shortest path problems. ACM Transactions on Algorithms (TALG), 3(1):1–15, 2007. doi:10.1145/1219944.1219951.DOI
  26. [27]Valerie King. Fully dynamic algorithms for maintaining all-pairs shortest paths and transitive closure in digraphs. In Proc. of the 40th Annual Symposium on Foundations of Computer Science (FOCS), pages 81–89. IEEE, 1999. doi:10.1109/SFFCS.1999.814580.
  27. [28]Adam Karczmarz and Piotr Sankowski. Sensitivity and dynamic distance oracles via generic matrices and frobenius form. In Proc. of the IEEE 64th Annual Symposium on Foundations of Computer Science (FOCS), pages 1745–1756. IEEE, 2023. doi: 10.1109/FOCS57990.2023.00106.DOI
  28. [29]Eugene L Lawler. A procedure for computing the k best solutions to discrete optimization problems and its application to the shortest path problem. Management science, 18(7):401–405, 1972.DOI
  29. [30]Cheng-Wei Lee and Hsueh-I Lu. Replacement paths via row minima of concise matrices. SIAM Journal on Discrete Mathematics, 28(1):206–225, 2014. doi: 10.1137/120897146.DOI
  30. [31]Kavindra Malik, Ashok K Mittal, and Santosh K Gupta. The k most vital arcs in the shortest path problem. Operations Research Letters, 8(4):223–227, 1989.
  31. [32]Vignesh Manoharan and Vijaya Ramachandran. Computing replacement paths in the CONGEST model. In Proc. of the 31st International Colloquium on Structural Information and Communication Complexity (SIROCCO), pages 420–437. Springer, 2024. doi:10.1007/978-3-031-60603-8_23.DOI
  32. [33]Enrico Nardelli, Guido Proietti, and Peter Widmayer. A faster computation of the most vital edge of a shortest path. Information Processing Letters, 79(2):81–85, 2001. doi:10.1016/S0020-0190(00)00175-7.DOI
  33. [34]Noam Nisan and Amir Ronen. Algorithmic mechanism design. In Proc. of the 31st annual ACM Symposium on Theory of Computing (STOC), pages 129–140, 1999. doi:10.1145/301250.301287.DOI
  34. [35]Jakob Nogler and Virginia Vassilevska Williams. Undirected replacement paths: Dual fault reduces to single source. In Proc. of the 53rd International Colloquium on Automata, Languages, and Programming (ICALP), volume 374 of Leibniz International Proceedings in Informatics (LIPIcs), pages 144:1–144:16. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2026. doi:10.4230/LIPIcs.ICALP.2026.144.DOI
  35. [36]OpenAI. Staggered extraction for exact matrix multiplication over every field. OpenAI Math Release preprint OAI:Staggered-extraction-for-exact-matrix-multiplication-over-every-field-September-24-2026, 2026.hub.valency.io/works/W_sbpa9e2y
  36. [37]OpenAI. An upper bound of 9/4 for the matrix multiplication exponent. OpenAI Math Release preprint OAI:Matrix-Multiplication-Nine-Fourths-October-2-2026, 2026.hub.valency.io/works/W_e65zjmxy
  37. [38]Hanlin Ren. Improved distance sensitivity oracles with subcubic preprocessing time. Journal of Computer and System Sciences, 123:159–170, 2022. doi:10.1016/j.jcss.2021.08.005.DOI
  38. [39]Liam Roditty and Uri Zwick. Replacement paths and k simple shortest paths in unweighted directed graphs. ACM Transactions on Algorithms, 8(4):33:1–33:11, 2012. Preliminary version in ICALP 2005. doi:10.1145/2344422.2344423.
  39. [41]Virginia Vassilevska Williams. Faster replacement paths. In Proc. of the twenty-second annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1337–1346. SIAM, 2011. doi:10.1137/1.9781611973082.102.DOI
  40. [42]Christian Wulff-Nilsen. Solving the replacement paths problem for planar directed graphs in O(n log n) time. In Proceedings of the 21st annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 756–765. SIAM, 2010. doi:10.1137/1.9781611973075.62.
  41. [43]Virginia Vassilevska Williams and R Ryan Williams. Subcubic equivalences between path, matrix, and triangle problems. Journal of the ACM (JACM), 65(5):1–38, 2018. doi:10.1145/3186893.DOI
  42. [44]Oren Weimann and Raphael Yuster. Replacement paths and distance sensitivity oracles via fast matrix multiplication. ACM Transactions on Algorithms (TALG), 9(2):1–13, 2013. doi:10.1145/2438645.2438646.DOI

Paper details

vlnc:W_dazcuuqz
v1 · latestHistory (1)

published · Fresh — added to the Hub within the last 30 days

added ·

Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

CC BY 4.0

Original source

  • Computer Science

GPT-6 Astra (OpenAI), Claude Fable 5.1 (bare) · View statement →

Looking for related papers…
Contents