Report-and-Run: A Simple Optimal Algorithm for All-Pairs Shortest Paths in Sparse Graphs

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.

Authors

Publication Details

Journal
arXiv
Published
2026-12-02
DOI
https://doi.org/10.48550/arxiv.2612.03886
Primary Topic
Complexity and Algorithms in Graphs
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
preprint

Report-and-Run: A Simple Optimal Algorithm for All-Pairs Shortest Paths in Sparse Graphs

Ken‐ichi Kawarabayashi, Yu Kohara
arXiv
Complexity and Algorithms in Graphs
preprint

Report-and-Run: A Simple Optimal Algorithm for All-Pairs Shortest Paths in Sparse Graphs

Ken‐ichi Kawarabayashi, Yu Kohara
preprint en

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.

arXiv
Complexity and Algorithms in Graphs
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon