On Computing Top-$k$ Simple Shortest Paths from a Single Source
Mattia D'Emidio, Gabriele Di Stefano
TL;DR
This work addresses the problem of computing top-$k$ simple shortest paths from a single source to all vertices (S-$k$ssp) in directed weighted graphs. It introduces a structural framework based on general predecessors and transitive closure, deriving lemmas that enable pruning and efficient computation. The authors present two algorithmic progressions: an exponential baseline (exh-S-kssp) and a polynomial-time bounded-S-kssp that explicitly computes P-$k$ssp for non-saturated predecessors, achieving a worst-case bound of $O(k(m\log(km)+n^2\,sp(n,m)))$, while matching the baseline in the worst case. Extensive experiments on real and synthetic graphs show that bounded-S-kssp yields significant practical speedups over naive methods (Yen's and pnc baselines), highlighting its suitability for large-scale, real-world ranking of root-to-vertex paths. The results point to strong practical impact and suggest future work on improving asymptotics and extending the approach to all-pairs variants.
Abstract
We investigate the problem of computing the top-$k$ simple shortest paths in weighted digraphs. While the single-pair variant -- finding the top-$k$ simple shortest paths between two specified vertices -- has been extensively studied over the past decades, with Yen's algorithm and its heuristic improvements emerging as the most effective solving strategies, relatively little attention has been devoted to the more general single-source version, where the goal is determining top-$k$ simple shortest paths from a source vertex to all other vertices. Motivated by the numerous practical applications of ranked shortest paths, in this paper we provide new insights and algorithmic contributions to this problem. In particular, we first present a theoretical characterization of the structural properties of its solutions. Then, we introduce the first polynomial-time algorithm specifically designed to handle it. On the one hand, we prove our new algorithm is on par, in terms of time complexity, with the best (and only) polynomial-time approach known in the literature to solve the problem, that is applying the fastest single-pair algorithm independently to each vertex pair formed by the source and the remaining vertices. On the other hand, through an extensive experimental evaluation on both real-world and synthetic graphs, we demonstrate that our algorithm consistently and significantly outperforms the latter baseline in terms of running time, achieving speed-ups of up to several orders of magnitude. These results establish our new algorithm as the solution to be preferred for computing $k$ simple shortest paths from a single source in practical settings.
