Algorithm Engineering of SSSP With Negative Edge Weights
Alejandro Cassis, Andreas Karrenbauer, André Nusser, Paolo Luigi Rinaldi
TL;DR
This work addresses single-source shortest paths with negative edge weights by implementing and evaluating a near-linear-time combinatorial algorithm inspired by Bringmann, Cassis, Fischer (2023). It combines Johnson’s trick with a graph decomposition (Decompose) and subroutines (LazyDijkstra, FixDAGEdges) to iteratively fix negativity, controlled by a depth parameter $\kappa$ that is bounded by the diameter of $G_{\geq 0}$. Through extensive engineering choices (SCC preprocessing, a 4-heap, a tunable light-vertex sampling parameter $K$, and a practical base-case threshold) and comprehensive experiments against the Goldberg–Radzik baseline, the authors demonstrate robust performance improvements on hard instances and provide near-linear scaling on restricted graphs. The results bridge theory and practice by showing that a combinatorial near-linear-time algorithm for SSSP with negative weights can be implemented efficiently and yield substantial speedups in challenging cases, validating its practical relevance for large-scale graphs and negative-weight scenarios.
Abstract
Computing shortest paths is one of the most fundamental algorithmic graph problems. It is known since decades that this problem can be solved in near-linear time if all weights are nonnegative. A recent break-through by [Bernstein, Nanongkai, Wulff-Nilsen '22] presented a randomized near-linear time algorithm for this problem. A subsequent improvement in [Bringmann, Cassis, Fischer '23] significantly reduced the number of logarithmic factors and thereby also simplified the algorithm. It is surprising and exciting that both of these algorithms are combinatorial and do not contain any fundamental obstacles for being practical. We launch the, to the best of our knowledge, first extensive investigation towards a practical implementation of [Bringmann, Cassis, Fischer '23]. To this end, we give an accessible overview of the algorithm, discussing what adaptions are necessary to obtain a fast algorithm in practice. We manifest these adaptions in an efficient implementation. We test our implementation on a benchmark data set that is adapted to be more difficult for our implementation in order to allow for a fair comparison. As in [Bringmann, Cassis, Fischer '23] as well as in our implementation there are multiple parameters to tune, we empirically evaluate their effect and thereby determine the best choices. Our implementation is then extensively compared to one of the state-of-the-art algorithms for this problem [Goldberg, Radzik '93]. On the hardest instance type, we are faster by up to almost two orders of magnitude.
