arXiv · 2612.03886
Report-and-Run: A Simple Optimal Algorithm for All-Pairs Shortest Paths in Sparse Graphs
Abstract
We present the Report-and-Run algorithm (R&R algorithm), a simple deterministic algorithm in the comparison-addition model that, given an $n$-vertex, $O(n)$-edge directed graph with arbitrary real edge weights, either detects a negative-weight cycle or solves the All-Pairs Shortest Paths (APSP) problem in $O(n^2)$ time. This matches the $Ω(n^2)$ output-size lower bound and gives the first optimal algorithm for sparse APSP in the comparison-addition model. We also introduce several variants of the R&R algorithm. First, for directed graphs with non-negative real weights and constant maximum in-degree and out-degree, we study computing the $k$ nearest vertices from every source. Under constant-time allocation of uninitialized arrays, lazy initialization yields deterministic $O(nk)$ time and $O(n^2)$ space, whereas randomized hash tables give $O(nk)$ expected time and $O(nk)$ worst-case space. Second, we present blocking and edge-caching heuristics that substantially reduce both comparisons and additions compared with Dijkstra's algorithm on sparse random graphs.
Explore related subjects
Keep this discovery
Explore connections, maps & timelines
Ken-ichi Kawarabayashi, Yu Kohara. 2026-12-02. Report-and-Run: A Simple Optimal Algorithm for All-Pairs Shortest Paths in Sparse Graphs. https://searcharxiv.org/abs/2612.03886
Citations retain the original authors and DOI and include this site’s record URL. If this discovery service contributed to your research, you can also cite Search arXiv by Indiciae: BibTeX · RIS.