Floyd-Warshall algorithm: Difference between revisions

Content added Content deleted
Line 196: Line 196:
The graph matrix holds the costs of each directed node. Row index corresponds to starting node. Column index corresponds to ending node. Unconnected nodes have infinite cost.
The graph matrix holds the costs of each directed node. Row index corresponds to starting node. Column index corresponds to ending node. Unconnected nodes have infinite cost.


This approach turns out to be faster than the more concise <./ .+~^:_ for many relatively small graphs (though floyd happens to be slightly slower for the task example).
This approach turns out to be faster than the more concise <./ .+~^:_ for many relatively small graphs (though <code>floyd</code> happens to be slightly slower for the task example).


=={{header|Java}}==
=={{header|Java}}==