Content deleted Content added
m clean up using AWB |
MorganGreen (talk | contribs) m →Algorithm description: grammar fix |
||
Line 6:
==Algorithm description==
Johnson's algorithm consists of the following steps:
#First, a new [[Vertex (graph theory)|node]] ''q'' is added to the graph, connected by zero-weight [[Edge (graph theory)|
#Second, the [[Bellman-Ford algorithm]] is used, starting from the new vertex ''q'', to find for each vertex ''v'' the least weight ''h''(''v'') of a path from ''q'' to ''v''. If this step detects a negative cycle, the algorithm is terminated.
#Next the edges of the original graph are reweighted using the values computed by the Bellman-Ford algorithm: an edge from ''u'' to ''v'', having length ''w(u,v)'', is given the new length ''w(u,v)'' + ''h(u)'' −''h(v)''.
|