Johnson's algorithm: Difference between revisions

Content deleted Content added
Brahle (talk | contribs)
Analysis: Corrected comparison with Floyd-Warshall
Undid revision 283160527 by Brahle (talk). You have it backwards: this one is good for sparse graphs, FW saves a log for dense.
Line 13:
 
==Analysis==
The [[time complexity]] of this algorithm, using [[Fibonacci heap]]s in the implementation of Dijkstra's algorithm, is O(''V''<sup>2</sup>log ''V'' + ''VE''): the algorithm uses O(''VE'') time for the Bellman-Ford stage of the algorithm, and O(''V'' log ''V'' + ''E'') for each of ''V'' instantiations of Dijkstra's algorithm. Thus, when the graph is densesparse, the total time can be faster than the [[Floyd-Warshall algorithm]], which solves the same problem in time O(''V''<sup>3</sup>).
 
==Example==