networks
shortpathtree
construct a shortest path spanning tree
Calling Sequence
Parameters
Description
Examples
shortpathtree(G, v)
G
-
graph or network
v
vertex
Important: The networks package has been deprecated.Use the superseding command GraphTheory[DijkstrasAlgorithm] instead.
This is an implementation of Dijkstra's algorithm for shortest path spanning tree. A priority queue is used for storing the edges.
The final distances are recorded as the vertex weights in the resulting graph (a spanning tree). The tree is rooted at v and the ancestors and daughters of each node are computed relative to this tree.
Edge weights are assumed to be lengths or distances so that edge weights are required to be non-negative. Undirected edges are assumed to be bidirectional.
This routine is normally loaded via the command with(networks) but may also be referenced using the full name networks[shortpathtree](...).
with⁡networks:
G≔petersen⁡:
T≔shortpathtree⁡G,1:
ancestor⁡T
table⁡2=1,3=2,4=5,5=1,6=1,7=6,9=5,8=2,10=6
daughter⁡T
table⁡1=2,5,6,2=3,8,3=∅,4=∅,5=4,9,6=7,10,7=∅,9=∅,8=∅,10=∅
See Also
GraphTheory
GraphTheory[DijkstrasAlgorithm]
networks(deprecated)[allpairs]
networks(deprecated)[diameter]
networks(deprecated)[eweight]
networks(deprecated)[spantree]
Download Help Document