arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2109.01872cs.DS
收藏

Floor-Warshall全对最短路算法的改进

Improving The Floyd-Warshall All Pairs Shortest Paths Algorithm

Ismail H. Toroslu

摘要:

Floor-Warshall算法是确定图中所有对之间的最短路径的最流行算法。这是一个非常简单和优雅的算法。然而,如果图不包含任何负加权边,则使用Dijkstra的最短路径算法为每个顶点作为源顶点来产生图的所有对最短路径,其效果比用于稀疏图的Floor-Warshall算法好得多。此外,对于具有负加权边的图,没有负圈,Johnson算法的性能仍然显着优于稀疏图的Floor-Warshall算法。Johnson算法首先利用Bellman-Ford算法将图转化为非负图,然后再应用Dijkstra算法。因此,在一般情况下,Floor-Warshall算法变得非常低效,特别是对于稀疏图。在本文中,我们展示了一个简单的改进的Floor-Warshall算法,这将提高其性能,特别是对于稀疏图,所以它可以用来代替更复杂的替代品。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑