且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

***的最短路径算法

更新时间:2021-09-01 23:34:05

的Dijkstra 小号算法找到的节点,并在图中每个其他节点之间的最短路径。你会运行一次为每个节点。权重必须为非负数,因此,如果有必要则必须先正常化在图表中的值。

Dijkstra's algorithm finds the shortest path between a node and every other node in the graph. You'd run it once for every node. Weights must be non-negative, so if necessary you have to normalise the values in the graph first.

弗洛伊德-沃肖尔的计算所有节点对之间的最短路径在一次运行!周期的权重必须是非负的,和图形必须的定向的(你的图是不是)。

Floyd-Warshall calculates the shortest routes between all pairs of nodes in a single run! Cycle weights must be non-negative, and the graph must be directed (your diagram is not).

约翰逊的算法是使用Dijkstra算法找到一个所有对单传,并更快稀疏的树木(见链接分析)。

Johnson's algorithm is using Dijkstra's algorithm to find all pairs in a single pass, and is faster for sparse trees (see the link for analysis).