Abstract

The paper describes two relatively simple modifications of the well-known Floyd-Warshall algorithm for computing all-pairs shortest paths. A fundamental difference of both modifications in comparison to the Floyd-Warshall algorithm is that the relaxation is done in a smart way. We show that the expected-case time complexity of both algorithms is O(n2log2n) for the class of complete directed graphs on n vertices with arc weights selected independently at random from the uniform distribution on [0, 1]. Theoretically best known algorithms for this class of graphs are all based on Dijkstra’s algorithm and obtain a better expected-case bound. However, by conducting an empirical evaluation we prove that our algorithms are at least competitive in practice with best know algorithms and, moreover, outperform most of them. The reason for the practical efficiency of the presented algorithms is the absence of use of priority queue.

Highlights

  • Finding shortest paths in graphs is a classic problem in algorithmic graph theory

  • We show that the expected-case time complexity of both algorithms is O(n2 log2 n) for the class of complete directed graphs on n vertices with arc weights selected independently at random from the uniform distribution on [0, 1]

  • In the first variant of the problem, we are searching for paths from a fixed vertex to every other vertex, while the all-pairs shortest path problem (APSP) asks for a shortest path between every pair of vertices

Read more

Summary

Introduction

Finding shortest paths in graphs is a classic problem in algorithmic graph theory. Given a (directed) graph in which arcs are assigned weights, a shortest path between pair of vertices is such a path that infimizes the sum of the weights of its constituent arcs. We can solve the APSP running Dijkstra’s algorithm from each vertex of the graph obtaining O(mn log n) solution where m is the number of arcs in the graph, provided we use the binary heap implementation of the priority queue. This is an improvement over the Floyd-Warshal solution for sparse graphs. For complete directed graphs on n vertices with arc weights selected independently at random from the uniform distribution on [0, 1], the Tree algorithm and the Hourglass algorithm both have an expected-case running time of O(n2 log n).

Preliminaries
Speeding up the Floyd-Warshall algorithm
The Tree algorithm
Initialize n empty trees
The Hourglass Algorithm
Distances
Lengths
Maximum outdegree
Expected-case analysis
Empirical evaluation
Empirical comparison of the number of relaxations
Empirical comparison of running times
Conclusion
Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call