Fully Dynamic All-Pairs Shortest Paths: Likely Optimal Worst-Case Update Time
Xiao Mao
Abstract
The All-Pairs Shortest Paths (APSP) problem is one of the fundamental problems in theoretical computer science. It asks to compute the distance matrix of a given n-vertex graph. We revisit the classical problem of maintaining the distance matrix under a fully dynamic setting undergoing vertex insertions and deletions with a fast worst-case running time and efficient space usage.
Although an algorithm with amortized update-time O(n 2 ) 1 has been known for nearly two decades [Demetrescu and Italiano, STOC 2003], the current best algorithm for worst-case running time with efficient space usage runs is due to [Gutenberg and Wulff-Nilsen, SODA 2020], which improves the space usage of the previous algorithm due to [Abraham, Chechik, and Krinninger, SODA 2017] to O(n 2 ) but fails to improve their running time of O(n 2+2/3 ). It has been conjectured that no algorithm in O(n 2.5-ε ) worst-case update time exists. For graphs without negative cycles, we meet this conjectured lower bound by introducing a Monte Carlo algorithm running in randomized O(n 2.5 ) time while keeping the O(n 2 ) space bound from the previous algorithm. Our breakthrough is made possible by the idea of "hopdominant shortest paths," which are shortest paths with a constraint on hops (number of vertices) that remain shortest after we relax the constraint by a constant factor.
1 Throughout this paper, we use O(f ) to denote O(f • poly log(f )). √ log n) time [Wil14], and thus it has been conjectured that an algorithm running in O(n 3-ε ) time is impossible for any ε > 0. However, under many dynamic settings of the APSP problem where the graph undergoes modifications such as vertex/edge insertion/deletions, the distance matrix can be updated in a faster time than a cubic re-computation from scratch.
The Problem. In this paper, we study the fully dynamic setting under vertex insertion/deletions with a faster worst-case time. Formally, we are given a graph G := V, E with |V | = n that undergoes vertex insertions and deletions where each vertex is inserted/deleted together with its incident edges. Our goal is to minimize the update time, which is the time needed to refresh the distance matrix. Specifically, since APSP without any updates already takes O(n 3 ) time, we allow a preprocessing procedure that takes place before the first update whose running time is not part of the update time since it does not "refresh" the distance matrix. We measure the worst-case update time which is opposed to amortized update time. In the randomized setting, the worst-case update time is a time bound under which every update can finish with the correct answer with a probability of 1n -c for some constant c > 0.
We point out that in the fully dynamic setting, vertex updates are always more general than edge updates since any edge update can be easily simulated by a deletion and a re-insertion of one of the two incident vertices.
Previous Work. Algorithms for dynamic All-Pairs Shortest Path Problem have been known since the 1960s, the earliest partially dynamic algorithm was the well-known Floyd-Warshall Algorithm [Flo62, War62] from as early as 1962 2 that can be easily extended to handle vertex insertion for O(n 2 ) time per update given the distance matrix of the current n-vertex graph. It was not until the end of that century that the first fully dynamic algorithm was given by King [Kin99], with O(n 2.5 √ W log n) amortized update time per edge insertion/deletion where W is the largest edge weight. Their algorithm was based on a classic data structure for decremental Single-Source Shortest Paths by Even and Shiloach [ES81]. Later, King and Thorup [KT01] improved the space bound from O(n 3 ) to O(n 2.5 √ W ). The follow-up work by Demetrescu and Italiano [DI02, DI06] generalized the result to real edge weights from a set of size S. In 2004, a breakthrough by Demetrescu and Italiano [DI04] gave an algorithm with O(n 2 ) amortized update time per vertex insertion/deletion using O(n 3 ) space. Thorup [Tho04] simplified their approach, shaved some logarithmic factors, and extended it to handle negative cycles. Based on his approach, he developed the first fully dynamic algorithm with a better worst-case update time for vertex insertion/deletions than recomputation from scratch with O(n 2+3/4 ) time per update, using a space super-cubic in n. In 2017, Abraham, Chechik and Krinninger [ACK17] improved the space to O(n 3 ) and designed a randomized algorithm with O(n 2+2/3 ) worst-case update time per vertex update against an adaptive adversary. The current state-of-the-art algorithms are by Gutenberg and Wulff-Nilsen in 2020 [GWN20b]. They achieved O(n 2+4/7 ) deterministic update time but failed to improve the randomized update time and instead only managed to improve space usage to O(n 2 ). Interestingly, their algorithm is a Las Vegas algorithm while both our algorithm and Abraham, Chechik
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext cd76fe82-08ef-440d-8fa7-155b1bee1222Cited by top-tier papers4
- On Dynamic Graph Algorithms with PredictionsJan van den Brand, Sebastian Forster, Yasamin Nazari, Adam PolakSODA 2024 · 4 citations
- Deterministic Fully Dynamic SSSP and MoreJan van den Brand, Adam KarczmarzFOCS 2023 · 2 citations
- Fine-Grained Optimality of Partially Dynamic Shortest Paths and MoreBarna Saha, Virginia Vassilevska Williams, Yinzhan Xu, Christopher YeSODA 2025
- Strongly Polynomial Parallel Work-Depth Tradeoffs for Directed SSSPAdam Karczmarz, Wojciech Nadara, Marek SokolowskiSODA 2026
Builds on5
- Deterministic Decremental SSSP and Approximate Min-Cost Flow in Almost-Linear TimeAaron Bernstein, Maximilian Probst Gutenberg, Thatchaphol SaranurakFOCS 2021 · 27 citations
- Deterministic Algorithms for Decremental Approximate Shortest Paths: Faster and SimplerMaximilian Probst Gutenberg, Christian Wulff-NilsenSODA 2020 · 20 citations
- Fully-Dynamic All-Pairs Shortest Paths: Improved Worst-Case Time and Space BoundsMaximilian Probst Gutenberg, Christian Wulff-NilsenSODA 2020 · 19 citations
- Decremental all-pairs shortest paths in deterministic near-linear timeJulia ChuzhoySTOC 2021 · 18 citations
- Faster Deterministic Worst-Case Fully Dynamic All-Pairs Shortest Paths via Decremental Hop-Restricted Shortest PathsShiri Chechik, Tianyi ZhangSODA 2023 · 5 citations
Related papers
- A Near-Optimal Offline Algorithm for Dynamic All-Pairs Shortest Paths in Planar DigraphsDebarati Das, Maximilian Probst Gutenberg, Christian Wulff-NilsenSODA 2022 · 2 citations
- A New Deterministic Algorithm for Fully Dynamic All-Pairs Shortest PathsJulia Chuzhoy, Ruimin ZhangSTOC 2023 · 7 citations
- Near-Optimal (1+ε)-Approximate Fully-Dynamic All-Pairs Shortest Paths in Planar GraphsArnold Filtser, Gramoz Goranci, Neel Patel, Maximilian Probst GutenbergFOCS 2024
- New Techniques and Fine-Grained Hardness for Dynamic Near-Additive SpannersThiago Bergamaschi, Monika Henzinger, Maximilian Probst Gutenberg, Virginia Vassilevska Williams et al.SODA 2021 · 19 citations
- Fully Dynamic Shortest Path Reporting Against an Adaptive AdversaryAnastasiia Alokhina, Jan van den BrandSODA 2024
