Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Johnson's algorithm
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Example== The first three stages of Johnson's algorithm are depicted in the illustration below. [[File:Johnson's algorithm.svg|540px|center]] The graph on the left of the illustration has two negative edges, but no negative cycles. The center graph shows the new vertex {{mvar|q}}, a shortest path tree as computed by the Bellman–Ford algorithm with {{mvar|q}} as starting vertex, and the values {{math|''h''(''v'')}} computed at each other node as the length of the shortest path from {{mvar|q}} to that node. Note that these values are all non-positive, because {{mvar|q}} has a length-zero edge to each vertex and the shortest path can be no longer than that edge. On the right is shown the reweighted graph, formed by replacing each edge weight {{tmath|w(u, v)}} by {{math|''w''(''u'',''v'') + ''h''(''u'') − ''h''(''v'')}}. In this reweighted graph, all edge weights are non-negative, but the shortest path between any two nodes uses the same sequence of edges as the shortest path between the same two nodes in the original graph. The algorithm concludes by applying Dijkstra's algorithm to each of the four starting nodes in the reweighted graph.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)