Table of Contents
Fetching ...

Anarchy in the APSP: Algorithm and Hardness for Incorrect Implementation of Floyd-Warshall

Jaehyun Koo

TL;DR

This work analyzes the Incorrect-APSP problem induced by executing the IJK loop order variant of Floyd Warshall. It provides a subcubic algorithm that computes the Incorrect-APSP matrix by combining a targeted single-source shortest path computation with a dynamic programming step for increasing path completion, yielding an overall $O\bigl(n\,T_{SSSP}(n,m)\bigr)$ time algorithm. The paper proves a subcubic equivalence between Incorrect-APSP and the classical APSP problem, showing that breakthroughs for one imply breakthroughs for the other. A key theoretical contribution is a precise path realization characterization, connecting KIJ and IJK relaxations to structured path families such as proper and valley paths. The results place Incorrect-APSP firmly in the landscape of APSP complete problems under subcubic reductions and illuminate the complexity barriers of seemingly innocent algorithmic mistakes.

Abstract

The celebrated Floyd-Warshall algorithm efficiently computes the all-pairs shortest path, and its simplicity made it a staple in computer science classes. Frequently, students discover a variant of this Floyd-Warshall algorithm by mixing up the loop order, ending up with the incorrect APSP matrix. This paper considers a computational problem of computing this incorrect APSP matrix. We will propose efficient algorithms for this problem and prove that this incorrect variant is APSP-complete.

Anarchy in the APSP: Algorithm and Hardness for Incorrect Implementation of Floyd-Warshall

TL;DR

This work analyzes the Incorrect-APSP problem induced by executing the IJK loop order variant of Floyd Warshall. It provides a subcubic algorithm that computes the Incorrect-APSP matrix by combining a targeted single-source shortest path computation with a dynamic programming step for increasing path completion, yielding an overall time algorithm. The paper proves a subcubic equivalence between Incorrect-APSP and the classical APSP problem, showing that breakthroughs for one imply breakthroughs for the other. A key theoretical contribution is a precise path realization characterization, connecting KIJ and IJK relaxations to structured path families such as proper and valley paths. The results place Incorrect-APSP firmly in the landscape of APSP complete problems under subcubic reductions and illuminate the complexity barriers of seemingly innocent algorithmic mistakes.

Abstract

The celebrated Floyd-Warshall algorithm efficiently computes the all-pairs shortest path, and its simplicity made it a staple in computer science classes. Frequently, students discover a variant of this Floyd-Warshall algorithm by mixing up the loop order, ending up with the incorrect APSP matrix. This paper considers a computational problem of computing this incorrect APSP matrix. We will propose efficient algorithms for this problem and prove that this incorrect variant is APSP-complete.
Paper Structure (13 sections, 15 theorems, 2 equations, 4 algorithms)

This paper contains 13 sections, 15 theorems, 2 equations, 4 algorithms.

Key Result

Theorem 1.2

Given a weighted graph with $n$ vertices and $m$ edges, we can solve the Incorrect-APSP in $O(n T_{SSSP}(n, m))$ time, where $T_{SSSP}(n, m)$ is the time to execute a single-source shortest path (SSSP) algorithm in a graph with $n$ vertices and $m$ edges.

Theorems & Definitions (32)

  • Definition 1.1: Incorrect-APSP
  • Theorem 1.2
  • Theorem 1.3
  • Definition 2.1
  • Corollary 2.2
  • proof
  • Corollary 2.3
  • proof
  • Definition 2.3
  • Definition 2.3
  • ...and 22 more