Two fast algorithms for all-pairs shortest paths

  • Authors:
  • C. W. Duin

  • Affiliations:
  • AKE, Faculteit Econometrie en Economie, Universiteit van Amsterdam, Roetersstraat 11, 1018 WB, Amsterdam

  • Venue:
  • Computers and Operations Research
  • Year:
  • 2007

Quantified Score

Hi-index 0.01

Visualization

Abstract

In a large, dense network, the computation of the 'distances', i.e., the shortest path lengths between all pairs of nodes, can take a long time with algorithms known from the literature. We present two all-pairs shortest path algorithms, based on the equations of Bellman. These algorithms run fast, much faster than indicated by their time complexity bound of O(n^2m), where n is the number of nodes and m the number of arcs. As in Bellman's method 'candidate' distances are maintained and updated, obtaining the distances eventually. However, the order of updating the candidate distances is changed, in such a way that arcs are eliminated as soon as it is clear that they are not relevant for the update of candidate distances later in the algorithm. In dense graphs this can significantly reduce the computation time. By scanning the arcs in order of increasing weight, arcs are eliminated earlier. By scanning the nodes in a 'pseudo-topological' order, the computation time can further decrease. In acyclic directed networks one of the resulting all-pairs algorithms runs in O(mlogn+nm"0) time, where m"0 denotes the number of 'essential' arcs, i.e., arcs that are indispensable in some shortest path.