Table of Contents
Fetching ...

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.

Algorithm Engineering of SSSP With Negative Edge Weights

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 that is bounded by the diameter of . Through extensive engineering choices (SCC preprocessing, a 4-heap, a tunable light-vertex sampling parameter , 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.

Paper Structure

This paper contains 19 sections, 1 theorem, 9 figures, 2 tables, 4 algorithms.

Key Result

Lemma 3

Given a restricted graph $G$ that consists of a single strongly-connected component, we have that $\kappa(G) \leq \mathrm{diam}(G_{\geq 0})$.

Figures (9)

  • Figure 1: Performance of OUR with and without the diameter upper bound on restricted random instances (see Section \ref{['sec:data']}).
  • Figure 2: Performance of OUR with LazyDijkstra and GOR on AUG-GOR (see Section \ref{['sec:data']}). This plot is the reason why we investigated on SHIFT-GOR.
  • Figure 3: Our main experiments comparing the running time of OUR and GOR.
  • Figure 4: Performance of OUR vs GOR on RANDOM RESTRICTED instances.
  • Figure 5: Schematic representation of BAD-BFCT instances with $15$ nodes and $18$ edges.
  • ...and 4 more figures

Theorems & Definitions (3)

  • Definition 1: SSSP with Negative Weights
  • Definition 2
  • Lemma 3: Diameter upper bound