all-pairs shortest paths in a graph
graph or network
name used to return a table of parents
Important: The networks package has been deprecated. Use the superseding command GraphTheory[AllPairsDistance] instead.
This procedure is an implementation of Floyd's allpairs shortest path algorithm.
The result, T, is a table of distances between any two vertices. Thus Tu,v is the shortest distance from u to v.
The optional extra parameter (eg. parents) is used to supply a name for a table of ancestors. Thus parentsu,v is the ancestor of v in the shortest path tree rooted at u.
Edge weights are assumed to be lengths or distances. Undirected edges are assumed to be bidirectional.
Edge weights must be non-negative.
This routine is normally loaded via the command with(networks) but may also be referenced using the full name networks[allpairs](...).
G ≔ petersen⁡:
T ≔ allpairs⁡G,p:
Download Help Document