Abstract 1 Introduction 2 Preliminaries 3 Technical overview References Appendix A Tables of our distance oracles

New Approximate Distance Oracles and Their Applications

Avi Kadria ORCID Bar Ilan University, Ramat Gan, Israel Liam Roditty ORCID Bar Ilan University, Ramat Gan, Israel
Abstract

Let G=(V,E) be an undirected graph with n vertices and m edges, and let μ=m/n. A distance oracle is a data structure designed to answer approximate distance queries, with the goal of achieving low stretch, efficient space usage, and fast query time. While much of the prior work focused on distance oracles with constant query time, this paper presents a comprehensive study of distance oracles with non-constant query time. We explore the tradeoffs between space, stretch, and query time of distance oracles in various regimes. Specifically, we consider both weighted and unweighted graphs in the regimes of stretch <2 and stretch 2. In addition, we demonstrate several applications of our new distance oracles to the n-Pairs Shortest Paths (n-PSP) problem and the All Nodes Shortest Cycles (ANSC) problem. Our main contributions are:

  • Weighted graphs: We present a new three-way trade-off between stretch, space, and query time, offering a natural extension of the classical Thorup–Zwick distance oracle [STOC’01 and JACM’05] to regimes with larger query time. Specifically, for any 0<r<1/2 and integer k1, we construct a (2k(12r)1)-stretch distance oracle with O~(m+n1+1/k) space and O~(μnr) query time. This construction provides an asymptotic improvement over the classical (2k1)-stretch and O(n1+1/k)-space tradeoff of Thorup and Zwick in sparse graphs, at the cost of increased query time. We also improve upon a result of Dalirrooyfard et al. [FOCS’22], who presented a (2k2)-stretch distance oracle with O(m+n1+1/k) space and O(μn1/k) query time. In our oracle we reduce the stretch from (2k2) to (2k5) while preserving the same space and query time.

  • Unweighted graphs: We present a (2k5,4+2odd)-approximation1112odd=2(d(u,v)mod2). distance oracle with O(n1+1/k) space and O(n1/k) query time. This improves upon a (2k2,2odd)-approximation distance oracle of Dalirrooyfard et al. [FOCS’22] while maintaining the same space and query time. We also present a distance oracle that given u,vV returns an estimate d^(u,v)d(u,v)+2d(u,v)/3+2, using O(n4/3+2ε) space and O(n13ε) query time. To the best of our knowledge, this is the first distance oracle that simultaneously achieves a multiplicative stretch <2, and a space complexity O(n1.5α), for some α>0.

  • Applications for n-PSP and ANSC: We present an O~(m11/(k+1)n)-time algorithm for the n-PSP problem, that for every input pair si,ti, where i[n], returns an estimate d^(si,ti) such that d^(si,ti)d(si,ti)+2d(si,ti)/2k. By allowing a small additive error, this result circumvents the conditional running time lower bound of Ω(m22k+1n1k+1o(1)), established by Dalirrooyfard et al. [FOCS’22] for achieving (1+1/k)-stretch. Additionally, we present an O~(mn11/k)-time algorithm for the ANSC problem that computes, for every uV, an estimate c^u such that c^uSC(u)+2SC(u)/2(k1), where SC(u) denotes the length of the shortest cycle containing u. This improves upon the O~(m22/kn1/k)-time algorithm of Dalirrooyfard et al. [FOCS’22], while achieving the same approximation guarantee.

We obtain our results by developing several new techniques, among them are the borderline vertices technique and the middle vertex technique, which may be of independent interest.

Keywords and phrases:
Distance oracles, Fine-grained algorithms, Graph algorithms, Data structures
Funding:
Liam Roditty: Supported in part by BSF grants 2016365 and 2020356.
Copyright and License:
[Uncaptioned image] © Avi Kadria and Liam Roditty; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Mathematics of computing Graph algorithms
Related Version:
Full Version: https://arxiv.org/abs/2509.00890 [27]
Editors:
Ho-Lin Chen, Wing-Kai Hon, and Meng-Tsung Tsai

1 Introduction

Let G=(V,E) be an undirected graph with n=|V| vertices and m=|E| edges with non-negative real edge weights, and let μ=m/n be the average degree. The distance dG(u,v) between u and v is the length of the shortest path222We omit G when it is clear from the context. between u and v in G. An estimation d^(u,v) of d(u,v) is an α-stretch if d(u,v)d^(u,v)αd(u,v).

In their seminal work, Thorup and Zwick [36] presented a data structure for distance approximations called a distance oracle. A distance oracle is a data structure with o(n2) space (otherwise we can trivially store the distance matrix), that supports distance queries between vertices. For any integer k1, they [36] showed that in O(kmn1/k) expected time, it is possible to preprocess a weighted undirected graph and create a distance oracle of size O(kn1+1/k). For every u,vV the query of the distance oracle returns a (2k1)-stretch for d(u,v) in O(k) time. Different aspects of distance oracles, such as construction time, query time, and stretch, have been studied since their introduction, more than two decades ago. For more details see for example [10, 29, 38, 18, 19, 23, 25, 26, 21, 4, 3, 12, 13, 15].

Thorup and Zwick [36] employed Erdős’ girth conjecture333The girth of a graph is the length of its shortest cycle. to establish a lower bound on the space/stretch tradeoff for distance oracles. The conjecture asserts the existence of graphs with Ω(n1+1/k) edges and girth 2k+2. Under this assumption, they proved that any distance oracle with stretch t2k1 must use Ω(n1+1/k) bits on some input, for all k1. However, these lower bounds apply to graphs with m=Ω(n1+1/k) edges.

This motivates studying the (2k1)-stretch/O(n1+1/k)-space tradeoff in sparser graphs, where m=o(n1+1/k). 444We remark that a distance oracle in such graphs must use Ω(m) space, because of similar arguments to the lower bound of [36]. This approach has been applied in two different stretch regimes. Distance oracles with stretch 2 (see, for example, [7, 6, 9, 33, 5, 25]) and distance oracles with stretch <2 (see, for example, [6, 8, 21, 28, 31]).

1.1 Distance oracles with stretch 𝟐

Our main result for stretch 2 establishes a three-way tradeoff among the key parameters of distance oracles: stretch, space, and query time. This new tradeoff improves upon previously known results for specific values of stretch, space, and query time. We prove the following:

Theorem 1.

Let k5 and let 0<c<k21 be an integer. There is an O~(m+n1+1/k) space distance oracle that given two query vertices u,vV computes in O(μnc/k)-time a distance estimation d^(u,v) that satisfies d(u,v)d^(u,v)(2k14c)d(u,v). The distance oracle is constructed in O~(mnc+2k) expected time.

An interesting tradeoff that follows from Theorem 1 is a better space/stretch tradeoff than the classical Thorup and Zwick [36] (2k1)-stretch / O~(n1+1/k) space tradeoff, at a cost of a larger query time. Specifically, by setting r=ck, we get a (2k(12r)1)-stretch distance oracle that uses O~(m+n1+1/k) space, at the price of O~(μnr) query time. By setting c=1 in Theorem 1, we improve upon a recent result of Dalirrooyfard, Jin, V. Williams, and Wein [22]. They presented a (2k2)-stretch distance oracle that uses O~(m+n1+1/k) space and O~(μn1/k) query time.555We remark that even more recently, Chechik, Hoch, and Lifshitz [20] presented a (2k3)-stretch n-PSP algorithm, however, they did not present a new distance oracle. We improve the stretch from (2k2) to (2k5) while using the same space and query time.

To obtain Theorem 1, we develop a new technique called the borderline vertices technique. Given u,vV, the borderline vertices τu and τv are two vertices on the shortest path between u and v that satisfy special properties that allow us to better exploit the structure of the Thorup and Zwick distance oracle. Using the borderline vertices technique, we also manage to achieve the following distance oracle, which improves upon the construction time of Theorem 1 at the cost of increasing the stretch.

Theorem 2.

Let k4 and let 0<c<k21 be an integer. There is an O~(m+n1+1/k) space distance oracle that given two query vertices u,vV computes in O~(μnc/k)-time a distance estimation d^(u,v) that satisfies d(u,v)d^(u,v)(2k4c)d(u,v). The distance oracle is constructed in O~(mnc+1k) expected time.

Agarwal, Godfrey, and Har-Peled [9] considered also small stretches, and presented a 2-stretch distance oracle that uses O~(m+n3/2) space and has O~(μn1/2) query time, that is constructed in O~(mn1/2) time, and a 3-stretch distance oracle that uses O~(m+n4/3) space and has O~(μn1/3) query time, and is constructed in O~(mn2/3) time. These results suggest that the following general stretch/space/query time tradeoff may exist for every k.

Problem 1.

For which values of k it is possible to construct a k-stretch distance oracle that uses O~(m+n1+1/k) space and has O~(μn1/k) query time.

Agarwal, Godfrey, and Har-Peled [9] solved Problem 1 for k=2,3. By setting c=1 in Theorem 2 and Theorem 1, respectively, we obtain a 4-stretch distance oracle that uses O~(m+n5/4) space and has O~(μn1/4) query time, and a 5-stretch distance oracle that uses O~(m+n6/5) space and has O~(μn1/5) query time. Thus, we solve Problem 1 for k=4,5.

In addition, using the borderline vertices technique we obtain (2k3)-stretch distance oracle that uses O~(m+n1+1/k) space, has O~(μn1/k) query time, and is constructed in O~(mn1/k) time. For k=3 this improves the construction time of [9] for a 3-stretch distance oracle from O~(mn2/3) to O~(mn1/3). Our results for weighted graphs are summarized in Table 2.

Next, we turn our focus to unweighted graphs. An estimation d^(u,v) of d(u,v) is an (α,β)-approximation if d(u,v)d^(u,v)αd(u,v)+β. (α,β)-approximations were extensively studied in the context of distance oracles, graph spanners, and emulators. (For more details see for example [24, 37, 11, 17, 16, 30, 1, 2, 9, 7, 13]).

From the girth conjecture, it follows that in unweighted graphs, for every (α,β)-distance oracle that uses O~(n1+1/k) space, it must hold that α+β2k1. However, this inequality must hold only for adjacent vertices. For non-adjacent vertex pairs, we prove the following simple lower bound.

Theorem 3.

Assuming the Erdős girth conjecture, any distance oracle that uses o(n1+1/k) space must have an input graph G=(V,E) and two vertices u,vV such that d(u,v)=2 and d^(u,v)2k+2.

A spanner is a subgraph HG that approximates distances without supporting distance queries. Baswana, Kavitha, Mehlhorn, and Pettie [11] and Parter [30] presented a k-spanner for every u,vV such that d(u,v)=2, and matched the lower bound of Theorem 3 for spanners. An interesting question is whether this lower bound can be matched by distance oracles with efficient distance queries as well. Thus, we formulate the following problem.

Problem 2.

For which values of k it is possible to construct a distance oracle with O~(n1+1/k) space that uses O~(n1/k) query time, such that d(u,v)d^(u,v)kd(u,v), for every u,vV that satisfy d(u,v)=2.

Agarwal, Godfrey, and Har-Peled [9] presented for unweighted graphs a (2,1)-approximation distance oracle that uses O~(n3/2) space, has O~(n1/2) query time, and is constructed in O~(mn1/2) time. They also presented a (3,2)-approximation distance oracle that uses O~(n4/3) space, has O~(n1/3) query time, that is constructed in O~(mn2/3) time.

By analyzing more carefully the (2,1)-approximation distance oracle of [9] it is possible to show that it is actually a (2,1odd)-approximation666xodd is defined as x1odd, where 1odd is d(u,v)mod2 distance oracle, and therefore solves Problem 2 for k=2.777In their work, the additive error comes from the fact that if B(u)B(v)= then min(h(u),h(v))d(u,v)/2+1. However, this can be improved by showing that if B(u)B(v)= then min(h(u),h(v))d(u,v)/2+1odd. In the following two theorems, we show that it is possible to solve Problem 2 for k=3 and k=4 as well.

Theorem 4.

There is a O~(n4/3) space distance oracle that given two query vertices u,vV computes in O~(n1/3)-time a distance estimation d^(u,v) that satisfies d(u,v)d^(u,v)3d(u,v)+2odd. The distance oracle is constructed in O~(mn1/3) expected time.

Theorem 5.

There is a O~(n5/4) space distance oracle that given two query vertices u,vV computes in O~(n1/4)-time a distance estimation d^(u,v) that satisfies d(u,v)d^(u,v)4d(u,v)+3odd. The distance oracle is constructed in O~(mn1/2) expected time.

In Theorem 4 we improve the distance oracle of [9] from more than a decade ago. In particular we improve the construction time from O~(mn2/3) to O~(mn1/3), and the approximation from (3,2) to (3,2odd). Dalirrooyfard, Jin, V. Williams, and Wein [22] presented a (2k2,2odd)-stretch distance oracle that uses O~(n1+1/k) space and O~(n1/k) query time. By setting k=4 in the (2k2,2odd)-stretch distance oracle of [22] they obtain a (6,2odd)-stretch distance oracle. In Theorem 5 we improve the approximation from (6,2odd) to (4,3odd) while maintaining the same space and query time.

To obtain our new distance oracles for unweighted graphs, presented in Theorem 4 and Theorem 5, we develop a new technique for using the middle vertex in the path, called the middle vertex technique. Let u,vV, the middle vertex τ is a vertex on the shortest path between u and v that satisfies d(u,τ)=d(u,v)/2+0.5odd and d(v,τ)=d(u,v)/20.5odd. As with the borderline vertices technique for sparse weighted graphs, the middle vertex technique enables us to better exploit the structure of the distance oracles of Thorup and Zwick in dense unweighted graphs.

By combining the middle vertex technique with the borderline vertices technique, we manage to achieve two more distance oracles for dense unweighted graphs. The first distance oracle improves the approximation of the distance oracle of Theorem 5 from (4,3odd) to (3,2+2odd) at the cost of increasing the query time to O~(n1/2).

Theorem 6.

There is a O~(n5/4) space distance oracle that given two query vertices u,vV computes in O~(n1/2)-time a distance estimation d^(u,v) that satisfies d(u,v)d^(u,v)3d(u,v)+2+2odd. The distance oracle is constructed in O~(mn1/2) expected time.

The second distance oracle improves the (2k2,2odd)-approximation of [22] to (2k5,4+2odd)-approximation, while using the same space and query time.

Theorem 7.

Let k5. There is an O~(n1+1/k) space distance oracle that given two query vertices u,vV computes in O~(n1/k)-time a distance estimation d^(u,v) that satisfies d(u,v)d^(u,v)(2k5)d(u,v)+4+2odd. The distance oracle is constructed in O~(mn3k) expected time.

Our results for unweighted graphs are summarized in Table 1.

1.2 Distance oracles with stretch <𝟐

For distance oracles with stretch <2 in weighted graphs, we present the following new three-way tradeoff between: stretch, space, and query time. We prove:

Theorem 8.

Let 0<c<1/3 be a real constant. There is a O~(m+n22c)-space distance oracle that given two query vertices u,vV computes in O~(μtntc)-time a distance estimation d^(u,v) that satisfies d(u,v)d^(u,v)(1+2/t)d(u,v). The distance oracle is constructed in O~(mn1c) time.

Using this tradeoff, we obtain the first distance oracle with stretch <2, sublinear query time, and O~(m+n1.5α) space, for α>0. In particular, by setting t=3 and c=1/3ε, we obtain a 5/3-stretch distance oracle with O~(m+n4/3+2ε)-space and O(μ3n13ε)-query time. For comparison, Agarwal [6] presented a distance oracle with stretch 1+1t+0.5, using O~(m+n2c) space and O~(μtn(t+1)c) query time. Setting t=1 and c=1/2ε in the construction of [6] yields a 5/3-stretch oracle with O~(m+n1.5+ε)-space and O~(μn0.5ε)-query time. (See Table 2.)

For unweighted graphs, we present two new tradeoffs. The first improves upon the tradeoff of the distance oracle of Bilò, Chechik, Choudhary, Cohen, Friedrich, and Schirneck [13], while preserving the same space and query time. Specifically, they presented a distance oracle for unweighted graphs that uses O~(n2c) space, has O~(ntc) query time, and returns an estimate d^(u,v)(1+1/t)d(u,v)+2. In the following theorem, we slightly improve the stretch bound to d^(u,v)d(u,v)+2d(u,v)2t, while using the same space and query time.

Theorem 9.

Let t1 be an integer and let 0<c<1/2 be a real constant. There is a O~(n2c)-space distance oracle that given two query vertices u,vV computes in O~(nct)-time a distance estimation d^(u,v) that satisfies d(u,v)d^(u,v)d(u,v)+2d(u,v)2t. The distance oracle is constructed in O~(mn1c) time.

Next, by adapting methods of Theorem 8 to unweighted graphs, we obtain another tradeoff that uses less space than the tradeoff of Theorem 9 at the cost of a larger query time. We prove:

Theorem 10.

Let t1. Let 0<c<1/3 be a real constant. There is a O~(n22c)-space distance oracle that given two query vertices u,vV computes in O~(ntc)-time a distance estimation d^(u,v) that satisfies d(u,v)d^(u,v)d(u,v)+2d(u,v)/t+2. The distance oracle is constructed in O~(mn1c) time.

In particular, using Theorem 10 we obtain the first distance oracle with o(n1.5α)-space, for α>0, that achieves a multiplicative error strictly better than 2. Specifically, by setting t=3 and c=1/3ε, we get a distance oracle with O~(n4/3+2ε) space and O~(n13ε) query time. These results are summarized in Table 1.

Table 1: Distance oracles in unweighted graphs. xodd is x(d(u,v)mod2).
Space Time Old Approximation New Approximation
O~(kn1+1/k) O~(n1/k) (2k2,2odd) [22] (2k5,4+2odd) (Th7)
O~(n4/3) O~(n1/3 ) (3,2) [7] (3,2odd) (Th4)
O~(n5/4) O~(n1/4) (6,2odd) [22] (4,3odd) (Th5)
O~(n5/4) O~(n1/2) (3,2+2odd) (Th6)
O~(n6/5) O~(n1/5) (8,2odd) [22] (5,4+2odd)
O~(n2c) O~(ntc) δ+δ/t+2 [13] δ+2δ/2t (Th9)
O~(n3/2+ϵ) O~(n12ϵ) 1.5δ+2 [13] δ+2δ/4 (Th9)
O~(n22c) O~(ntc) δ+2δ/t+2 (Th10)
O~(n4/3+2ϵ) O~(n13ϵ) δ+2δ/3+2 (Th10)

1.3 Applications for 𝒏-PSP and 𝑨𝑵𝑺𝑪

Recently, Dalirrooyfard, Jin, V. Williams, and Wein [22] (followed by Chechik, Hoch and Lifshitz [20]) studied two fundamental problems in graphs, the n-pairs shortest paths (n-PSP) problem and the all-nodes shortest cycles (ANSC) problem. The n-PSP problem is defined as follows. Given a set of vertex pairs (si,ti), for 1iO(n), compute the distance d(si,ti). The ANSC problem is defined as follows. Compute the length of the shortest simple cycle that contains v, for every vV.

A straightforward approach for solving the n-PSP problem is to first construct a distance oracle and then query it for every pair in the input set. The total runtime of this approach is the sum of the construction time and n times the query time of the distance oracle. While this method naturally yields an n-PSP algorithm, a distance oracle must satisfy additional requirements that an n-PSP algorithm does not. In particular, a distance oracle must use limited space and support queries between any of the Ω(n2) pairs of vertices.

Using our new distance oracles, we obtain improved time/stretch tradeoffs for both the n-PSP problem and the ANSC-problem, improving some of the results of [22, 20].

In [22], a lower bound based on the combinatorial 4k clique hypothesis for the n-PSP problem is presented. They showed that Ω(m22k+1n1k+1o(1)) time is required to achieve (1+1/kε) stretch. As mentioned in [22] using the (1+1/k)-distance oracle of [6] it is possible to solve n-PSP with (1+1/k)-stretch in O(m22k+1n1k+1) time, which almost matches the lower bound of [22]. In this paper, we show that it is possible to significantly improve the running time of [6] and to bypass the lower bound of [22] at the cost of a small additive error (of up to 2). We obtain an O(m11k+1n) time algorithm that returns d^(si,ti)d(si,ti)+2d(si,ti)2k(1+1/k)d(u,v)+2, as presented in the following theorem.

Theorem 11.

Let k2. Given an unweighted graph G and vertex pairs (si,ti) for 1iO(n), there is an algorithm for nPSP that computes an estimation d^(si,ti) such that d(si,ti)d^(si,ti)d(si,ti)+2d(si,ti)2k in O~(m11k+1n) time.

In [22] they presented an O(m+n2/k) time n-PSP algorithm that returns (2k2)(2k1)-stretch. In the following theorem we improve the stretch from (2k1)(2k2) to (2k1)(2k3) while using the same running time.

Theorem 12.

Let k3. Given a weighted graph G and vertex pairs (si,ti) for 1iO(n), there is an algorithm for nPSP that computes an estimation d^(si,ti) such that d(si,ti)d^(si,ti)(2k1)(2k3) in O~(m+n2/k) time.

For the ANSC problem, [22] presented an O(m22/kn1/k) running time algorithm that for every uV returns estimate c^(u) such that c^uSC(u)+2SC(u)2(k1), where SC(u) is the length of the shortest simple cycle that contains u. In the following theorem, we improve the running time from O(m22/kn1/k) of [22] to O~(mn11k).

Theorem 13.

Given an undirected unweighted graph G, let k be a positive integer. There is a randomized algorithm for ANSC that computes for every uV an estimation c^u such that SC(u)c^u1+2SC(u)2(k1) in O~(mn11k)-time.

In addition, we present the first, to the best of our knowledge, stretch <2 algorithm for the ANSC problem in weighted graphs. Specifically, we present an O(m21/k) time algorithm for weighted graphs that for every uV returns an estimate c^ such that c^u1+1k1SC(u), as presented in the following theorem.

Theorem 14.

Given an undirected weighted graph G, let k be a positive integer. There is a randomized algorithm for ANSC that computes for every uV an estimation c^u such that SC(u)c^u(1+1k1)SC(u) in O~(m21k)-time.

Our results for the ANSC problem are summarized in Table 4.

The rest of this paper is organized as follows. In the next section, we present some necessary preliminaries. In Section 3 we present a technical overview of our main techniques and some of our new distance oracles. In the full version [27] of the paper, we present the full proofs of our techniques, distance oracles, applications, and lower bound.

2 Preliminaries

In this section, we present several definitions and existing tools that we use to develop our new techniques and ideas which we then apply in order to obtain new distance oracles. Let G=(V,E) be an undirected graph with n=|V| vertices and m=|E| edges. Throughout the paper, we consider both unweighted graphs and weighted graphs with non-negative real edge weights.

Let u,vV. The distance d(u,v) between u and v is the length of a shortest path between u and v. Let P(u,v) be the shortest path between u and v. Let N(u) be the vertices that are neighbors of u and let deg(u)=|N(u)| be the degree of u. Let XV. Let N(X) be the vertices that are neighbors of some vertex uX, i.e, N(X)={wV|xX:(w,x)E}. The distance d(u,X) between u and X is the distance between u and the closest vertex to u from X, that is, d(u,X)=minxX(d(u,x)). Let p(u,X)=argminxX(d(u,x)) (ties are broken in favor of the vertex with a smaller identifier).

Next, we define bunches and clusters as in [36]. Let uV and let X,YV. Let B(u,X,Y)={vXd(u,v)<d(u,Y)} be the bunch of u with respect to X and Y. Let C(u,Y)={vVd(u,v)<d(v,Y)} be the cluster of u with respect to Y.

The starting point in many algorithms and data structures for distance approximation, and in particular in Thorup and Zwick[36]’s distance oracles, is a hierarchy of vertex sets A0,A1,,Ak, where A0=V, Ak= and for 0ik1, Ai+1Ai and |Ai|=n1i/k. For every uV, let pi(u)=p(u,Ai) and let hi(u)=d(u,Ai). Using this hierarchy, Thorup and Zwick defined k bunches for every vertex uV as follows: For every 0ik1, the bunch Bi(u) is defined as Bi(u)=B(u,Ai,Ai+1). They also defined a cluster for every vertex wAiAi+1 as follows: C(w)=C(w,Ai+1). Throughout the paper when we save Bi(u), for every uV and 0ik1 (or C(u)=C(u,Ai+1), for every uAiAi+1), we mean that we can check whether xBi(u) (or xC(u)) in constant time and if xBi(u) (or xC(u)) we can retrieve d(u,x) in constant time as well.

The simplest instance of this hierarchy is when k=2 and the hierarchy is composed of the sets A0,A1,A2, where A0=V, A1V, and A2=. Throughout this paper, in such a case, we will omit subscripts and will refer to A1 simply as A. Moreover, since in this case B0(u)=B(u,V,A) and B1(u)=B(u,A,)=A, for every uV, we use B(u) to denote B0(u) and A to denote B1(u) and since we have only p0(u) and p1(u), where p0(u) is u, we use p(u) to denote p1(u) and h(u) to denote h1(u).

Thorup and Zwick [36] construct the sets A1,,Ak1, by adding to Ai+1, where i[0,k2], every vertex of Ai, independently at random with probability p. Constructing the sets in such a way allows Thorup and Zwick [36] to prove the following:

Lemma 15 ([36]).

Given an integer parameter k2, we can compute in O~(n) time sets A1,,Ak1, such that |Ai|=O(n1i/k) for every i[1,k1] with high probability, and for every i[0,k1] the size of Bi(u) is O(n1/k), with high probability (w.h.p). The cost of computing Bi(u), for every uV, is O~(mn1/k) expected time.

Lemma 16 ([35]).

Given a parameter p, we can compute a set A of size O~(np) in O~(mp1) expected time such that, |C(w,A)|=O(1/p), for every vertex wVA, and |B(v,V,A)|=O(1/p) for every vV.

We remark that both Lemma 15 and Lemma 16 have also slower deterministic constructions [34, 35].

Next, we present procedure Intersection. The input to Intersection is two vertices u,wV and two sets U,WV, such that, uU and wW. For every uU and every wW, we assume that distance estimations d(u,u) and d(w,w) are known. The output of Intersection is minxUWd(u,x)+d(w,x), if UW and , otherwise. (See Algorithm 1.) In most of our uses of Intersection we have d(u,u)=d(u,u) and d(w,w)=d(w,w). When this is not the case, we explicitly describe d and its relation to d.

Algorithm 1 Intersection(u,w,U,W).

The following lemma regarding the running time of Intersection is straightforward.

Lemma 17.

Intersection(u,w,U,W) runs in O(min(|U|,|W|)).

Proof.

Assume, without loss of generality (wlog), that |U||W|. By checking for every vertex yW in O(1) time whether yU we compute UW. For each vertex xUW, we compute in O(1) time the value d(u,x)+d(x,w). Thus, the total running time is min(|U|,|W|)O(1)=O(min(|U|,|W|)), as required.

The following property of Intersection(u,w,U,W) is the main feature of Intersection, and will be used throughout the paper.

Property 17.

Let P=P(u,w). If P(UW), and there exists xP(UW) such that d(u,x)=d(u,x) and d(x,v)=d(x,v) then Intersection(u,w,U,W) returns d(u,w).

Let TZQuery be the query of the distance oracle presented by Thorup and Zwick [36]. We let MTZQuery(u,v) be min(TZQuery(u,v),TZQuery(v,u)). Pseudocode for TZQuery exists in Algorithm 2.

Algorithm 2 TZQuery(u,v).

The following lemma appears explicitly in [36] regarding the correctness and running time of MTZQuery.

Lemma 18 ([36]).

The running time of MTZQuery is O(k) and it holds that

MTZQuery(u,v)(2k1)d(u,v)

The next lemma follows from [36], and we prove it here for completeness.

Lemma 19.

Let d^(u,v) be MTZQuery(u,v). For every integer 1ik, one of the following holds.

  • min(hi(u),hi(v))min(hi1(u),hi1(v))+d(u,v)

  • d^(u,v)2min(hi1(u),hi1(v))+d(u,v)

Proof.

Wlog, assume that hi1(u)hi1(v). We divide the proof into two cases. The case that pi1(u)Bi(v) and the case that pi1(u)Bi(v). Consider the case that pi1(u)Bi(v). In this case the value of d(pi1(u),v) is saved in the distance oracle. From the triangle inequality it follows that d(pi1(u),v)hi1(u)+d(u,v). Therefore, we have that d^(u,v)hi1(u)+d(pi1(u),v)2hi1(u)+d(u,v). Since hi1(u)hi1(v) we get that d^(u,v)2min(hi1(u),hi1(v))+d(u,v), as required.

Consider now the case that pi1(u)Bi(v). From the definition of Bi(v) it follows that hi(v)d(v,pi1(u))d(u,v)+hi1(u). Since hi1(u)hi1(v), we get that hi(v)min(hi1(u),hi1(v))+d(u,v), and thus min(hi(u),hi(v))min(hi1(u),hi1(v))+d(u,v), as required. The following property follows by applying Lemma 19 inductively.

Property 19.

Let 1ik be an integer, and let 1j<i. Then either:

  • min(hi(u),hi(v))min(hi1(u),hi1(v))+d(u,v)

  • d^(u,v)2min(hj(u),hj(v))+(ij)d(u,v)

We remark that all our distance oracles return an estimation that is the length of a path in G and therefore d(u,v)d^(u,v).

3 Technical overview

In the classic distance oracle of Thorup and Zwick [36], it is possible to bound hi(u) with d(u,v)+hi1(v), for every 1ik1. The key to improving the (2k1)-stretch of the distance oracle lies in tightening the bound on hi(u). Previous work (see, for example, [9, 32, 5, 8, 6]) improved the bound on h1(u) from d(u,v) to d(u,v)/2 by exploiting the following structural property of B0(): if P(u,v)B0(u)B0(v), then h1(u)+h1(v)d(u,v)+1odd.

In this paper, we develop two new techniques that exploit structural properties of C() to construct a distance oracle with improved stretch guarantees. These techniques enable us to bound not only h1(u) by d(u,v)/2, but also h2(u) by d(u,v), thereby improving overall stretch. We begin by presenting the borderline vertices technique, which applies to both weighted and unweighted graphs.

3.1 The borderline vertices technique

Let C(u)=C(u)N(C(u)) be an augmented cluster. Roughly speaking, using the borderline vertices technique we show that if P(u,v)C(u,Ac)C(v,Ac) then
max(hc+1(u),hc+1(v))d(u,v). In particular, by setting c=1 we get an improvement over the result of [9], showing not only that h1(u)d(u,v)/2 but also that h2(u)d(u,v).

Let P=P(u,v) be a shortest path between u and v. The borderline vertex τu(P) of C(u) in P is the farthest vertex from u in C(u)P. Similarly, the borderline vertex τv(P) of C(u) in P is the farthest vertex from v in C(v)P. Obviously, a distance oracle cannot store τu(P) for every shortest path P, as this would require Θ(n2) space. We overcome this limitation by using O~(μ|C(u)|) query time to iterate over all vertices in the augmented cluster C(u), and in particular τu=τu(P).

To obtain our improved bound on h2(v), we analyze two different cases regarding p1(τu). The case that p1(τu)B1(v) and the case that p1(τu)B1(v). If p1(τu)B1(v), then the query algorithm can return as an estimation d^(u,v)=uτup1(τu)v, where xyzw is d(x,y)+d(y,z)+d(z,w). In this case, since τuC(u,A1) (as it is the farthest vertex from u in C(u)) we get that h1(τu)d(u,τu)d(u,v), and therefore d^(u,v)3d(u,v).

Otherwise, if p1(τu)B1(v) then h2(v)d(v,p1(τu))d(v,τu)+h1(τu). Since h1(τu)d(u,τu) we get that h2(v)d(v,τu)+d(u,τu)=d(u,v), as wanted. (See Figure 1). Using symmetric arguments for τv, we can also get that h2(u)d(u,v).

In unweighted graphs, we can avoid the μ factor from the query time at the cost of bounding h2(u) and h2(v) by d(u,v)+2 rather than d(u,v). The difference is that we let τu(P) be defined as the farthest vertex from u in C(u)P (unlike τu(P) which considers C(u)P). Next, we provide an overview of our main three-way tradeoff that uses the borderline vertices technique.

3.2 (𝟐𝒌𝟏𝟒𝒄)-stretch distance oracle

Let 0<c<k/21 be an integer, let V=A0,Ac,Ac+1,,Ak=, such that |Ai|=n1i/k. The storage of the distance oracle saves: the graph G, d(s1,s2), for every s1Ac+1,s2Akc2 and B(u)=i{0[c,k]}Bi(u) for every uV. Where B0(u)=B(u,V,Ac).

The query works as follows. First, we set d^(u,v) to
Intersection(u,v,C(u,Ac),C(v,Ac)). Then, we iterate over every uC(u,Ac) (to iterate over τu), and update d^(u,v) be min(d^(u,v),d(u,u)+MTZQuery(u,v)). Similarly, for every vC(v,Ac) we update d^(u,v) to min(d^(u,v),d(v,v)+MTZQuery(v,u)). Finally, the algorithm returns min(d^(u,v),upc+1(u)pkc2(v)v,upkc2(u)pc+1(v)v).

Figure 1: p1(τu)B1(v).

It is straightforward to see that the space is O(m+n1+1/k) and that the query takes O(μ|C(u,Ac)|)=O(μnc/k) time. The main technical contribution is in proving that d^(u,v)(2k4c1)d(u,v). To prove it, we use the borderline vertices technique. Since that τuC(u,Ac), when the algorithm iterates over C(u,Ac), there is an iteration in which u=τu. In this iteration we guarantee that d^(u,v)d(u,τu)+MTZQuery(τu,v). Since τu is a borderline vertex, we either have that d^(u,v)uτupc(τu)v3d(u,v), and the estimation guarantee holds, or that hc+1(v)d(u,v). Similarly, since τvC(v,Ac) and we iterate over C(u,Ac), there is an iteration in which v=τv. In this iteration, either a short path is found (vτvpc(τu)u), or we have that hc+1(u)d(u,v).

From the properties of MTZQuery, for every c+1<i<k, either a short path is found or hi(u)d(u,v)+hi1(v). Since hc+1(u)d(u,v) and hc+1(v)d(u,v), it follows that

hkc2(u)max(hc+1(u),hc+1(v))+(k2c3)d(u,v)(k2c2)d(u,v).

In the query procedure, we have that d^(u,v)upkc2(u)pc+1(v)v2hkc2(u)+d(u,v)+2hc+1(v). Thus:

d^(u,v)2(k2c2)d(u,v)+d(u,v)+2d(u,v)=(2k4c1)d(u,v),

as required.

3.3 The middle vertex technique

For unweighted graphs, we develop the middle vertex technique that allows us to bound either h2(u) or h2(v) by d(u,v)/2+1ODD, improving the previous 3d(u,v)/2+1ODD bound from [22]. Roughly speaking, using the middle vertex technique technique we show that if P(u,v)C(u,A1)C(v,A1) then min(h2(u),h2(v))d(u,v)+1odd. The middle vertex technique requires O(n1/k) query time, matching the query time of the unweighted borderline technique. However, by using the middle vertex technique we reduce the additive error from 2 to 1odd in the bound of min(h2(u),h2(v)).

For the sake of simplicity, let A0,A1,A2,A3 be a vertex hierarchy, where A0=V, A3= and let d(u,v)=δ be even. Let τ be the middle vertex on P(u,v). That is, d(u,τ)=d(τ,v)=δ/2 (δ/2 is an integer since δ is even). The middle vertex τ has the following useful property. If h1(τ)>δ/2 then u,vB0(τ). The problem is that τ is unknown. However, the case that u,vB0(τ) is equivalent to the case that τC(u)C(v). We use the O(n1/k) query time to compute for every wC(u)C(v) the value of d(u,w)+d(w,v). Therefore, even without knowing τ, in this case we have that d^(u,v)=δ. (See Figure 2(a).)

If h1(τ)δ/2 then d(u,p1(τ))d(u,τ)+h1(τ)δ and d(v,p1(τ))δ. If p1(τ)B1(u)B1(v), we exploit, again, the O(n1/k) query time to compute for every wB1(u)B1(v) the value d(u,w)+d(w,v). Therefore, even without knowing p1(τ) the query algorithm returns d^(u,v)d(u,p1(τ))+d(v,p1(τ))2δ. (See Figure 2(b).) If p1(τ)B1(u)B1(v) then without loss of generality p1(τ)B1(u) and therefore h2(u)d(u,p1(τ))δ. (See Figure 2(c).)

Our distance oracles for unweighted graphs use the middle vertex technique. When combined with the unweighted borderline vertices technique, this enables the construction of two additional oracles.

Figure 2: (a) τC(u)C(v). (b) p1(τ)B1(u)B1(v). (c) p1(τ)B1(u)B1(v). In the figure p1(τ)B1(v).

3.4 Distance oracles with stretch <𝟐

Let AV be a set of size O(n1c), let u,vV, let δ=d(u,v) and let P=P(u,v). Let t0 be an integer. Let St(u)=wSt1(u)B(w), where S0(u)={u}. Let dt be a distance function induced by St (for the exact definition of dt. Let u=u0 (resp. v=v0). For every 1it, let uiB(ui1) (resp. viB(vi1)) be the farthest vertex in P from u (resp. v). (See Figure 3 for an illustration.) Let Pt(u)=P(u,ut). By the definition of St(u) we have that Pt(u)St(u). We prove the following two properties:

  • If Pt(u)Pt(v) then dt(u,w)+dt(v,w)=δ for some wPt(u)Pt(v). (See Figure 3(b).)

  • If Pt(u)Pt(v)= then i=0t1h(ui)+h(vi)δ+2t1. (See Figure 3(a).)

Next, we overview the distance oracle that uses these properties. The distance oracles stores the graph G and d(x,y), for every x,yA×V, at the cost of O(|V||A|)=O(m+n2c) space. In the query of the distance oracle, we compute St(u) and St(v). To address the case that Pt(u)Pt(v) we compute for every wSt(u)St(v) in O(min(|St(u)|,|St(v)|)) time the value dt(u,w)+dt(v,w). In such a case, from the first property we have dt(u,w)+dt(v,w)=δ, for some w.

To address the case that Pt(u)Pt(v)= we compute d(u,p(w))+d(p(w),v) for every wSt(u)St(v). Let wi=0t1{ui,vi} be the vertex with minimal h(w) value. Using the bound i=0t1h(ui)+h(vi)d(u,v)+2t1, we can show that h(w)(d(u,v)+2t1)/2t=d(u,v)/2t and get that d(u,p(w))+d(p(w),v)δ+2δ/2t.

Next, we reduce the space from O(n2c) to O(n22c) by saving d(x,y), for every x,yA×A instead of saving d(x,y), for every x,yA×V.

This information prevents us from using paths of the form up(w)v. We can still use paths of the form uuip(ui)p(vj)vjv. However, since we do not know the vertices ui and vj we need to consider all vertex pairs in St1(u)×St1(v). This increases the query time from O(ntc) to O(n2(t1)c). To avoid O(n2(t1)c) query time, we show that it suffices to consider only vertex pairs in Si(u)×St1i(v), where 0it1 in O(tn(t1)c)-time, and still get the same approximation without iterating over all vertex pairs in St1(u)×St1(v).

We define the set Q={ui,vti10it1}. Let q=qu,qvQ be the vertex pair with minimal h(qu)+h(qv) value. We prove that h(qu)+h(qv)(d(u,v)+2t1)/t=d(u,v)/t+1. While iterating over the pairs of Si(u)×St1i(v), we encounter q, and get that d^(u,v)δ+2δ/t+2. Thus, with O(n22c) space and O(ntc) query time we get an estimation d^(u,v)δ+2δ/t+2. By setting c=1/3ε and t=2,3 we get two new distance oracles, one with O(n4/3+2ε) space and O(n2/32ε) query, and estimation d^(u,v)δ+2δ/2+22δ+4, and another with O(n4/3+2ε) space and O(n13ε) query, and estimation d^(u,v)δ+2δ/3+253δ+4.

We also consider weighted graphs with non-negative real edge weights. Agarwal, Godfrey and Har-Peled [7] defined B(u) to be B(u)N(B(u)). We revise the definition of St to be wSt1(u)B(u). This new definition allows us to extend the previous results to weighted graphs. The distance oracles obtained using this approach are presented in the full version[27].

We remark that the usage of the sets St(u) and St(v) in the query algorithm is similar to the usage of the graph H in the work of [14]. However, in our analysis of the unweighted case, we achieve a slightly better distance approximation. In addition, we introduce a new approach to obtain a distance estimation using two vertices from A that are close to P(u,v) rather than a single vertex from A, as in [14].

Figure 3: (a) P4(u)P4(v)=. The blue interval between ui (vi) and p(ui) (p(vi)), where i{0,1,2}, is bounded by the red interval between ui (vi) and ui+1 (vi+1) plus 1. The orange interval plus 1 bounds h(u3)+h(v3). (b) P4(u)P4(v)={x}.

References

  • [1] Amir Abboud and Greg Bodwin. The 4/3 additive spanner exponent is tight. J. ACM, 64(4):28:1–28:20, 2017. doi:10.1145/3088511.
  • [2] Amir Abboud, Greg Bodwin, and Seth Pettie. A hierarchy of lower bounds for sublinear additive spanners. SIAM J. Comput., 47(6):2203–2236, 2018. doi:10.1137/16M1105815.
  • [3] Amir Abboud, Karl Bringmann, and Nick Fischer. Stronger 3-sum lower bounds for approximate distance oracles via additive combinatorics. In Barna Saha and Rocco A. Servedio, editors, Proceedings of the 55th Annual ACM Symposium on Theory of Computing, STOC 2023, Orlando, FL, USA, June 20-23, 2023, pages 391–404. ACM, 2023. doi:10.1145/3564246.3585240.
  • [4] Amir Abboud, Karl Bringmann, Seri Khoury, and Or Zamir. Hardness of approximation in p via short cycle removal: cycle detection, distance oracles, and beyond. In Stefano Leonardi and Anupam Gupta, editors, STOC ’22: 54th Annual ACM SIGACT Symposium on Theory of Computing, Rome, Italy, June 20 - 24, 2022, pages 1487–1500. ACM, 2022. doi:10.1145/3519935.3520066.
  • [5] Ittai Abraham and Cyril Gavoille. On approximate distance labels and routing schemes with affine stretch. In David Peleg, editor, Distributed Computing - 25th International Symposium, DISC 2011, Rome, Italy, September 20-22, 2011. Proceedings, volume 6950 of Lecture Notes in Computer Science, pages 404–415. Springer, 2011. doi:10.1007/978-3-642-24100-0_39.
  • [6] Rachit Agarwal. The space-stretch-time tradeoff in distance oracles. In Andreas S. Schulz and Dorothea Wagner, editors, Algorithms - ESA 2014 - 22th Annual European Symposium, Wroclaw, Poland, September 8-10, 2014. Proceedings, volume 8737 of Lecture Notes in Computer Science, pages 49–60. Springer, 2014. doi:10.1007/978-3-662-44777-2_5.
  • [7] Rachit Agarwal, Brighten Godfrey, and Sariel Har-Peled. Faster approximate distance queries and compact routing in sparse graphs. CoRR, abs/1201.2703, 2012. arXiv:1201.2703.
  • [8] Rachit Agarwal and Philip Brighten Godfrey. Distance oracles for stretch less than 2. In Sanjeev Khanna, editor, Proceedings of the Twenty-Fourth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2013, New Orleans, Louisiana, USA, January 6-8, 2013, pages 526–538. SIAM, 2013. doi:10.1137/1.9781611973105.38.
  • [9] Rachit Agarwal, Philip Brighten Godfrey, and Sariel Har-Peled. Approximate distance queries and compact routing in sparse graphs. In INFOCOM 2011. 30th IEEE International Conference on Computer Communications, Joint Conference of the IEEE Computer and Communications Societies, 10-15 April 2011, Shanghai, China, pages 1754–1762. IEEE, 2011. doi:10.1109/INFCOM.2011.5934973.
  • [10] Surender Baswana and Telikepalli Kavitha. Faster algorithms for all-pairs approximate shortest paths in undirected graphs. SIAM J. Comput., 39(7):2865–2896, 2010. doi:10.1137/080737174.
  • [11] Surender Baswana, Telikepalli Kavitha, Kurt Mehlhorn, and Seth Pettie. Additive spanners and (alpha, beta)-spanners. ACM Trans. Algorithms, 7(1):5:1–5:26, 2010. doi:10.1145/1868237.1868242.
  • [12] Davide Bilò, Shiri Chechik, Keerti Choudhary, Sarel Cohen, Tobias Friedrich, Simon Krogmann, and Martin Schirneck. Approximate distance sensitivity oracles in subquadratic space. In Barna Saha and Rocco A. Servedio, editors, Proceedings of the 55th Annual ACM Symposium on Theory of Computing, STOC 2023, Orlando, FL, USA, June 20-23, 2023, pages 1396–1409. ACM, 2023. doi:10.1145/3564246.3585251.
  • [13] Davide Bilò, Shiri Chechik, Keerti Choudhary, Sarel Cohen, Tobias Friedrich, and Martin Schirneck. Improved approximate distance oracles: Bypassing the thorup-zwick bound in dense graphs. CoRR, abs/2307.11677, 2023. doi:10.48550/arXiv.2307.11677.
  • [14] Davide Bilò, Shiri Chechik, Keerti Choudhary, Sarel Cohen, Tobias Friedrich, and Martin Schirneck. Improved approximate distance oracles: Bypassing the thorup-zwick bound in dense graphs. arXiv preprint arXiv:2307.11677, 2023. doi:10.48550/arXiv.2307.11677.
  • [15] Davide Bilò, Shiri Chechik, Keerti Choudhary, Sarel Cohen, Tobias Friedrich, and Martin Schirneck. Improved distance (sensitivity) oracles with subquadratic space. In 2024 IEEE 65th Annual Symposium on Foundations of Computer Science (FOCS), pages 1550–1558. IEEE, 2024. doi:10.1109/FOCS61266.2024.00097.
  • [16] Greg Bodwin and Virginia Vassilevska Williams. Better distance preservers and additive spanners. ACM Trans. Algorithms, 17(4), October 2021. doi:10.1145/3490147.
  • [17] Shiri Chechik. New additive spanners. In Sanjeev Khanna, editor, Proceedings of the Twenty-Fourth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2013, New Orleans, Louisiana, USA, January 6-8, 2013, pages 498–512. SIAM, 2013. doi:10.1137/1.9781611973105.36.
  • [18] Shiri Chechik. Approximate distance oracles with constant query time. In David B. Shmoys, editor, Symposium on Theory of Computing, STOC 2014, New York, NY, USA, May 31 - June 03, 2014, pages 654–663. ACM, 2014. doi:10.1145/2591796.2591801.
  • [19] Shiri Chechik. Approximate distance oracles with improved bounds. In Rocco A. Servedio and Ronitt Rubinfeld, editors, Proceedings of the Forty-Seventh Annual ACM on Symposium on Theory of Computing, STOC 2015, Portland, OR, USA, June 14-17, 2015, pages 1–10. ACM, 2015. doi:10.1145/2746539.2746562.
  • [20] Shiri Chechik, Itay Hoch, and Gur Lifshitz. New approximation algorithms and reductions for n-pairs shortest paths and all-nodes shortest cycles. In Yossi Azar and Debmalya Panigrahi, editors, Proceedings of the 2025 Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2025, New Orleans, LA, USA, January 12-15, 2025, pages 5207–5238. SIAM, 2025. doi:10.1137/1.9781611978322.177.
  • [21] Shiri Chechik and Tianyi Zhang. Path-reporting distance oracles with logarithmic stretch and linear size. In Karl Bringmann, Martin Grohe, Gabriele Puppis, and Ola Svensson, editors, 51st International Colloquium on Automata, Languages, and Programming, ICALP 2024, July 8-12, 2024, Tallinn, Estonia, volume 297 of LIPIcs, pages 42:1–42:18. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2024. doi:10.4230/LIPICS.ICALP.2024.42.
  • [22] Mina Dalirrooyfard, Ce Jin, Virginia Vassilevska Williams, and Nicole Wein. Approximation algorithms and hardness for n-pairs shortest paths and all-nodes shortest cycles. In 63rd IEEE Annual Symposium on Foundations of Computer Science, FOCS 2022, Denver, CO, USA, October 31 - November 3, 2022, pages 290–300. IEEE, 2022. doi:10.1109/FOCS54457.2022.00034.
  • [23] Michael Elkin, Ofer Neiman, and Christian Wulff-Nilsen. Space-efficient path-reporting approximate distance oracles. Theor. Comput. Sci., 651:1–10, 2016. doi:10.1016/J.TCS.2016.07.038.
  • [24] Michael Elkin and David Peleg. (1+epsilon, beta)-spanner constructions for general graphs. SIAM J. Comput., 33(3):608–631, 2004. doi:10.1137/S0097539701393384.
  • [25] Michael Elkin and Seth Pettie. A linear-size logarithmic stretch path-reporting distance oracle for general graphs. ACM Trans. Algorithms, 12(4):50:1–50:31, 2016. doi:10.1145/2888397.
  • [26] Michael Elkin and Idan Shabat. Path-reporting distance oracles with logarithmic stretch and size o(n log log n). In 64th IEEE Annual Symposium on Foundations of Computer Science, FOCS 2023, Santa Cruz, CA, USA, November 6-9, 2023, pages 2278–2311. IEEE, 2023. doi:10.1109/FOCS57990.2023.00141.
  • [27] Avi Kadria and Liam Roditty. New approximate distance oracles and their applications. arXiv preprint arXiv:2509.00890, 2025.
  • [28] Tsvi Kopelowitz, Ariel Korin, and Liam Roditty. On the space usage of approximate distance oracles with sub-2 stretch. In Karl Bringmann, Martin Grohe, Gabriele Puppis, and Ola Svensson, editors, 51st International Colloquium on Automata, Languages, and Programming, ICALP 2024, July 8-12, 2024, Tallinn, Estonia, volume 297 of LIPIcs, pages 101:1–101:18. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2024. doi:10.4230/LIPICS.ICALP.2024.101.
  • [29] Manor Mendel and Assaf Naor. Ramsey partitions and proximity data structures. In 47th Annual IEEE Symposium on Foundations of Computer Science (FOCS 2006), 21-24 October 2006, Berkeley, California, USA, Proceedings, pages 109–118. IEEE Computer Society, 2006. doi:10.1109/FOCS.2006.65.
  • [30] Merav Parter. Bypassing erdős’ girth conjecture: Hybrid stretch and sourcewise spanners. In Javier Esparza, Pierre Fraigniaud, Thore Husfeldt, and Elias Koutsoupias, editors, Automata, Languages, and Programming - 41st International Colloquium, ICALP 2014, Copenhagen, Denmark, July 8-11, 2014, Proceedings, Part II, volume 8573 of Lecture Notes in Computer Science, pages 608–619. Springer, 2014. doi:10.1007/978-3-662-43951-7_49.
  • [31] Ely Porat and Liam Roditty. Preprocess, set, query! Algorithmica, 67(4):516–528, 2013. doi:10.1007/S00453-013-9825-9.
  • [32] Mihai Pǎtraşcu and Liam Roditty. Distance oracles beyond the thorup-zwick bound. SIAM J. Comput., 43(1):300–311, 2014. doi:10.1137/11084128X.
  • [33] Mihai Pǎtraşcu, Liam Roditty, and Mikkel Thorup. A new infinity of distance oracles for sparse graphs. In 53rd Annual IEEE Symposium on Foundations of Computer Science, FOCS 2012, New Brunswick, NJ, USA, October 20-23, 2012, pages 738–747. IEEE Computer Society, 2012. doi:10.1109/FOCS.2012.44.
  • [34] Liam Roditty, Mikkel Thorup, and Uri Zwick. Deterministic constructions of approximate distance oracles and spanners. In Luís Caires, Giuseppe F. Italiano, Luís Monteiro, Catuscia Palamidessi, and Moti Yung, editors, Automata, Languages and Programming, 32nd International Colloquium, ICALP 2005, Lisbon, Portugal, July 11-15, 2005, Proceedings, volume 3580 of Lecture Notes in Computer Science, pages 261–272. Springer, 2005. doi:10.1007/11523468_22.
  • [35] Mikkel Thorup and Uri Zwick. Compact routing schemes. In Arnold L. Rosenberg, editor, Proceedings of the Thirteenth Annual ACM Symposium on Parallel Algorithms and Architectures, SPAA 2001, Heraklion, Crete Island, Greece, July 4-6, 2001, pages 1–10. ACM, 2001. doi:10.1145/378580.378581.
  • [36] Mikkel Thorup and Uri Zwick. Approximate distance oracles. J. ACM, 52(1):1–24, 2005. doi:10.1145/1044731.1044732.
  • [37] Mikkel Thorup and Uri Zwick. Spanners and emulators with sublinear distance errors. In Proceedings of the Seventeenth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2006, Miami, Florida, USA, January 22-26, 2006, pages 802–809. ACM Press, 2006. URL: http://dl.acm.org/citation.cfm?id=1109557.1109645.
  • [38] Christian Wulff-Nilsen. Approximate distance oracles with improved preprocessing time. In Yuval Rabani, editor, Proceedings of the Twenty-Third Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2012, Kyoto, Japan, January 17-19, 2012, pages 202–208. SIAM, 2012. doi:10.1137/1.9781611973099.18.

Appendix A Tables of our distance oracles

A.1 Weighted graphs with stretch 𝟐

Table 2: Distance oracles in weighted graphs.
Construction Space Time Stretch Ref. Comments
O~(mn1/k) O~(n1+1/k) O~(1) 2k1 [36]
O~(mn3/k) O~(m+n1+1/k) O~(μnc/k) 2k14c Th1 1c<k/2
O~(mn3/k) O~(m+n1+1/k) O~(μnr) 2k(12r)1 Th1 c/k=r<1/2
O~(mn1/k) O~(m+n1+1/k) O~(μn1/k) 2k2 [22] k3
O~(mn1/k) O~(m+n1+1/k) O~(μn1/k) 2k3 Th15[27] k3
O~(mn2/k) O~(m+n1+1/k) O~(μn1/k) 2k4 Th2 k4
O~(mn3/k) O~(m+n1+1/k) O~(μn1/k) 2k5 Th1 k5
O~(mn2/3) O~(m+n4/3) O~(μn1/3) 3 [7]
O~(mn1/3) O~(m+n4/3) O~(μn1/3) 3 Th15[27]
O~(mn1/2) O~(m+n5/4) O~(μn1/4) 4 Th2
O~(mn3/5) O~(m+n6/5) O~(μn1/5) 5 Th1
O~(mn1c) O~(m+n2c) O~(μtntc) 1+1/t [6] c<1/2
O~(mn1c) O~(m+n2c) O~(μtn(t+1)c) 1+1/(t+0.5) [6] c<1/2
O~(mn1c) O~(m+n22c) O~(μtntc) 1+2/t Th8 c<1/3

A.2 𝒏-PSP and 𝑨𝑵𝑺𝑪 results

Table 3: nPSP in weighted graphs unless stated otherwise. δ=d(u,v).
Time Approximation Ref. Comment
O~(m+n1+2/k) (2k1)(2k2)δ+4k2 [22] Unweighted, k2
O~(m+n1+2/k) (2k1)(2k3)δ Theorem 12 k2
Ω(m22k+1n1k+1o(1)) (1+1/k)δ [22]
O~(m22k+1n1k+1) (1+1/k)δ [6]888This result is obtained by constructing the distance oracle of Agarwal [6] and querying it n times.
O~(m11k+1n) δ+2δ/2k Theorem 11 Unweighted, k2
Table 4: ANSC algorithm improvements in undirected graphs. SC(u) is the shortest cycle for u.
Time Approximation Ref. Comment
O~(m22/kn1/k) SC(u)+2SC(u)/2(k1) [22] Unweighted, k2
O~(mn11/k) SC(u)+2SC(u)/2(k1) Theorem 13 Unweighted, k2
O~(m21k) (1+1k1)SC(u) Theorem 14 Weighted, k2