当前位置: X-MOL 学术arXiv.cs.DS › 论文详情
Our official English website, www.x-mol.net, welcomes your feedback! (Note: you will need to create a separate account there.)
Improving The Floyd-Warshall All Pairs Shortest Paths Algorithm
arXiv - CS - Data Structures and Algorithms Pub Date : 2021-09-04 , DOI: arxiv-2109.01872
Ismail H. Toroslu

The Floyd-Warshall algorithm is the most popular algorithm for determining the shortest paths between all pairs in a graph. It is very a simple and an elegant algorithm. However, if the graph does not contain any negative weighted edge, using Dijkstra's shortest path algorithm for every vertex as a source vertex to produce all pairs shortest paths of the graph works much better than the Floyd-Warshall algorithm for sparse graphs. Also, for the graphs with negative weighted edges, with no negative cycle, Johnson's algorithm still performs significantly better than the Floyd-Warshall algorithm for sparse graphs. Johnson's algorithm transforms the graph into a non-negative one by using the Bellman-Ford algorithm, then, applies the Dijkstra's algorithm. Thus, in general the Floyd-Warshall algorithm becomes very inefficient especially for sparse graphs. In this paper, we show a simple improvement on the Floyd-Warshall algorithm that will increases its performance especially for the sparse graphs, so it can be used instead of more complicated alternatives.

中文翻译:

改进 Floyd-Warshall All Pairs Shortest Paths 算法

Floyd-Warshall 算法是最流行的算法,用于确定图中所有对之间的最短路径。这是一个非常简单而优雅的算法。但是,如果图不包含任何负加权边,则使用 Dijkstra 的每个顶点的最短路径算法作为源顶点来生成图的所有对最短路径比用于稀疏图的 Floyd-Warshall 算法要好得多。此外,对于具有负权重边的图,没有负循环,Johnson 算法的性能仍然明显优于 Floyd-Warshall 算法的稀疏图。Johnson 算法使用 Bellman-Ford 算法将图转换为非负图,然后应用 Dijkstra 算法。因此,一般来说,Floyd-Warshall 算法变得非常低效,尤其是对于稀疏图。在本文中,我们展示了对 Floyd-Warshall 算法的简单改进,该改进将提高其性能,特别是对于稀疏图,因此可以使用它代替更复杂的替代方案。
更新日期:2021-09-07
down
wechat
bug