,
Liam Roditty
Creative Commons Attribution 4.0 International license
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 k ≥ 1, we construct a (2k(1 - 2r) - 1)-stretch distance oracle with Õ(m + n^{1 + 1/k}) space and Õ(μ n^r) query time. This construction provides an asymptotic improvement over the classical (2k - 1)-stretch and O(n^{1 + 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 (2k - 2)-stretch distance oracle with O(m + n^{1 + 1/k}) space and O(μ n^{1/k}) query time. In our oracle we reduce the stretch from (2k - 2) to (2k - 5) while preserving the same space and query time.
- Unweighted graphs: We present a (2k - 5, 4 + 2_{odd})-approximation distance oracle with O(n^{1 + 1/k}) space and O(n^{1/k}) query time. This improves upon a (2k - 2, 2_{odd})-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,v ∈ V returns an estimate d̂(u,v) ≤ d(u,v) + 2⌈ d(u,v) / 3 ⌉ + 2, using O(n^{4/3 + 2ε}) space and O(n^{1 - 3ε}) 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(n^{1.5 - α}), for some α > 0.
- Applications for n-PSP and ANSC: We present an Õ(m^{1 - 1/(k+1)} n)-time algorithm for the n-PSP problem, that for every input pair ⟨s_i,t_i⟩, where i ∈ [n], returns an estimate d̂(s_i, t_i) such that d̂(s_i,t_i) ≤ d(s_i,t_i) + 2⌈d(s_i,t_i)/2k⌉. By allowing a small additive error, this result circumvents the conditional running time lower bound of Ω(m^{2 - 2/(k+1)} ⋅ n^{1/(k+1) - o(1)}), established by Dalirrooyfard et al. [FOCS’22] for achieving (1 + 1/k)-stretch. Additionally, we present an Õ(mn^{1 - 1/k})-time algorithm for the ANSC problem that computes, for every u ∈ V, an estimate ĉ_u such that ĉ_u ≤ SC(u) + 2⌈SC(u)/2(k - 1)⌉, where SC(u) denotes the length of the shortest cycle containing u. This improves upon the Õ(m^{2 - 2/k}n^{1/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.
@InProceedings{kadria_et_al:LIPIcs.ISAAC.2025.43,
author = {Kadria, Avi and Roditty, Liam},
title = {{New Approximate Distance Oracles and Their Applications}},
booktitle = {36th International Symposium on Algorithms and Computation (ISAAC 2025)},
pages = {43:1--43:17},
series = {Leibniz International Proceedings in Informatics (LIPIcs)},
ISBN = {978-3-95977-408-6},
ISSN = {1868-8969},
year = {2025},
volume = {359},
editor = {Chen, Ho-Lin and Hon, Wing-Kai and Tsai, Meng-Tsung},
publisher = {Schloss Dagstuhl -- Leibniz-Zentrum f{\"u}r Informatik},
address = {Dagstuhl, Germany},
URL = {https://drops.dagstuhl.de/entities/document/10.4230/LIPIcs.ISAAC.2025.43},
URN = {urn:nbn:de:0030-drops-249514},
doi = {10.4230/LIPIcs.ISAAC.2025.43},
annote = {Keywords: Distance oracles, Fine-grained algorithms, Graph algorithms, Data structures}
}