Floyd Warshall works with minimal edge algorithm algorithms because the correctness of the algorithm does not depend on the weight of the edge, which is non-negative, while the correctness of Dijkstra's algorithm is based on this fact.
The correctness of Dijkstra's algorithm:
We have 2 sets of vertices at any step of the algorithm. Set A consists of vertices on which we calculated the shortest paths. Set B consists of the remaining vertices.
Inductive hypothesis . At each step, we will assume that all previous iterations are correct.
Inductive step . When we add the vertex V to the set A and specify the distance to dist [V], we must prove that this distance is optimal. If this is not optimal, then there must be some other way to the vertex V, which has a shorter length.
, X B.
, dist[V] <= dist[X], V dist [V], .
:
S T U . , S T
min (shortest_path ( S U) + shortest_path ( U T)) U .
, , , . , .