floyd: Find the shortest paths in a directed graph
Description
The Floyd-Warshall algorithm finds all shortest paths (if exist) in a directed graph.
Usage
floyd(x)
Value
Returns a list with final costs and the shortest path between two nodes.
Arguments
x
adjacency matrix of a directed graph. \((i,j)\)-entry represents the
weight (cost) of the edge from \(i\) to \(j\) if one exists and \(\infty\)
otherwise.
References
Floyd, R.W. (1962).
Algorithm 97: Shortest Path.
Communications of the ACM5 (6), 345.