English

A Polynomial-Time Algorithm for the Next-to-Shortest Path Problem on Positively Weighted Directed Graphs

Data Structures and Algorithms 2025-11-07 v1

Abstract

Given a graph and a pair of terminals ss, tt, the next-to-shortest path problem asks for an s ⁣ ⁣ts\!\to \!t (simple) path that is shortest among all not shortest s ⁣ ⁣ts\!\to \!t paths (if one exists). This problem was introduced in 1996, and soon after was shown to be NP-complete for directed graphs with non-negative edge weights, leaving open the case of positive edge weights. Subsequent work investigated this open question, and developed polynomial-time algorithms for the cases of undirected graphs and planar directed graphs. In this work, we resolve this nearly 30-year-old open problem by providing an algorithm for the next-to-shortest path problem on directed graphs with positive edge weights.

Keywords

Cite

@article{arxiv.2511.04345,
  title  = {A Polynomial-Time Algorithm for the Next-to-Shortest Path Problem on Positively Weighted Directed Graphs},
  author = {Kuowen Chen and Nicole Wein and Yiran Zhang},
  journal= {arXiv preprint arXiv:2511.04345},
  year   = {2025}
}
R2 v1 2026-07-01T07:24:32.155Z