Darwin Help

Back to Index

Path

Function Path - find a path between two nodes of a graph

Calling Sequence  Path(g,n1,n2)
Parameters
NameTypeDescription

g Graphgiven graph
n1 Nodesource node
n2 Nodedestination node
Return Type  list(Edge)
Synopsis Find a path between n1 and n2, returning all the edges that need to be traversed in a list. If there is no path, it returns an empty list.
Examples
> g := Graph( Edges(Edge(1.2,1,2),Edge(2,1,4),Edge(3,1,5),Edge(4,2,3),Edge(5,3,4)),Nodes(1,2,3,4,5));
g := Graph(Edges(Edge(1.2000,1,2),Edge(2,1,4),Edge(3,1,5),Edge(4,2,3),Edge(5,3,4
)),Nodes(1,2,3,4,5))
> Path(g,3,5);
[Edge(4,2,3), Edge(1.2000,1,2), Edge(3,1,5)]


See also BipartiteGraph,   Clique,   DrawGraph,   Edge,   EdgeComplement,   Edges,   FindConnectedComponents,   Graph,   Graph_Rand,   InduceGraph,   MaxCut,   MaxEdgeWeightClique,   MST,   Nodes,   RegularGraph,   ShortestPath,   TetrahedronGraph,   VertexCover