Skip to content
Preprint

Local Representatives and Shortest Completions for Next-to-Shortest Paths in Directed Graphs

Sep 2026 · 0 citations · 31 references
Computer Science

Abstract

Given a directed graph with positive edge weights and two vertices s,t, a next-to-shortest s-t path is a shortest simple s-t path among those whose length is strictly larger than the shortest-path distance. The problem was introduced by Lalgudi, Papaefthymiou and Potkonjak in 1996; it is NP-hard when zero-weight edges are allowed, and its complexity on positively weighted digraphs remained open for almost three decades until Chen, Wein and Zhang recently gave a polynomial-time algorithm running in O(n^4 m^3 log n) time. We give a substantially faster algorithm within their optimal-middle-segment framework. The core idea is to split the problem into"choosing a prefix"and"completing it". Given a prefix P: s ->A made of shortest-path edges, delete the vertices used by P, forbid leaving A along shortest-path edges, and the best completion is one shortest-path computation. The difficulty lies in choosing P: even for a fixed A, deciding whether some shortest prefix admits a completion is NP-complete. We do not solve these fixed-A subproblems one by one. Fix any globally optimal next-to-shortest path; its middle segment induces a boundary edge x ->c in the shortest-path DAG. For the correct triple (A,B,x), the optimal path certifies c as a feasible next hop, and we prove that every feasible next hop that is not earlier than c in a topological order can be combined with the same middle segment into another globally optimal path. Hence only the feasible next hop of maximum topological index is kept per triple, giving O(n^3) representatives, all generated by a two-dimensional DAG dynamic program with a local reward. The total running time is O(n^3 (m + n log n)), and O(n^3 m) on unweighted graphs. The proof rests on an uncrossing lemma: the last intersection between a reference prefix and the candidate's partner suffix can always be moved strictly earlier, which cannot go on forever.

View source

Similar papers

Preprint Aug 2026

Instance-Optimality of Bidirectional Dijkstra on Simple Graphs

It is shown that bidirectional Dijkstra is still instance-optimal on simple undirected weighted graphs under the order-oblivious model, where incident edges are given in a random order, and under the order-dependent model, where bidirectional Dijkstra is not instance-optimal.

Christian Bertram, Mads Vestergaard Jensen, Mikkel Thorup et al. · 1 citation
Preprint Sep 2026

A Faster Undirected Single-Source Shortest Path Algorithm

A faster algorithm for SSSP in weighted undirected graphs, giving the first improvement in running time since the FOCS'23 breakthrough of Duan, Mao, Shu, and Yin is presented.

Avi Kadria, L. Roditty · 0 citations
Preprint Sep 2026

Exponential Lower Bounds for Integer-Weighted Shortest-Paths Preservers of DAGs

We study a graph simplification problem introduced by Bernstein, Bodwin, and Wein [ITCS'24]. We start with a graph with arbitrarily large positive edge weights and the goal is to reweight the edges to small aspect ratio (ratio between largest and smallest weight) while preserving the shortest paths structure (the seque...

Michael Yi Wang, Nicole Wein · 0 citations
Conference Open access Sep 2026

Finding Simple Shortest-Paths via Centroids

Centroids are used to compute an arbitrary number of simple paths with some important benefits: the expansion of a single centroid delivers an arbitrary number of paths; only a single Dijk-stra search is required to complete the task; the same algorithm can be easily coupled with heuristics that improve search efficien...

Carlos Linares López, I. Herman · 0 citations
Preprint Sep 2026

Low-Stretch Spanning Trees via Smoothed Analysis of Dijkstra's Algorithm

Given an undirected weighted graph $G$, a $\gamma$-approximate low-stretch spanning tree (LSST) $T \subseteq G$ is a tree that approximates the distance metric of $G$ up to a $\gamma$-factor in expectation. Currently, existing algorithms to find a provably good LSST carefully construct an approximate shortest-path tree...

Ioannis Dorkofikis, Bernhard Haeupler, Maximilian Probst Gutenberg et al. · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.