networks
path
finds a path in a directed tree
Calling Sequence
Parameters
Description
Examples
path([a, b], G)
G
-
graph or network
[a, b]
list of two vertices
Important: The networks package has been deprecated.Use the superseding package GraphTheory instead.
If there is a directed path from a to b a list containing the nodes on the path is returned. The message FAIL is returned when no such path can be found.
The notion of a path depends exclusively on the status of the ancestor and daughter tables. These properties are not ordinarily maintained by the standard graph primitives such as addedge() and delete(). It is maintained by calls to spantree() and shortpathtree().
This routine is normally loaded via the command with(networks) but may also be referenced using the full name networks[path](...).
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=∅
path⁡9,1,T
FAIL
path⁡1,9,T
1,5,9
See Also
GraphTheory
networks(deprecated)[ancestor]
networks(deprecated)[daughter]
networks(deprecated)[shortpathtree]
with
Download Help Document