[ library(grasper) | Reference Manual | Alphabetic Index ]

# path(+Graph, +OriginVertex, +TerminusVertex)

Ensures Graph represents a path between OriginVertex and TerminusVertex in Graph.
Graph
A graph.
OriginVertex
Initial vertex in the path between OriginVertex and TerminusVertex in Graph.
TerminusVertex
Final vertex in the path between OriginVertex and TerminusVertex in Graph.

## Description

Ensures Graph represents a path between OriginVertex and TerminusVertex in Graph.

### Fail Conditions

Fails if Graph is not a graph variable, if OriginVertex does not belong to Graph's vertex-set, if TerminusVertex does not belong to Graph's vertex-set or if Graph can not be constrained to define a path between OriginVertex and TerminusVertex.

## Examples

```?- path(G,Origin,Terminus).
No.

?- V`::[]..[1,2,3,4], E`::[]..[[1,2],[1,3],[1,4],[2,4],[3,4]], dirgraph(G,V,E), path(G, 1, 5).
No.

?- V`::[]..[1,2,3,4], E`::[]..[[1,2],[1,3],[1,4],[2,4],[3,4]], dirgraph(G,V,E), path(G, 5, 1).
No.

?- V`::[]..[1,2,3,4], E`::[]..[[1,2],[1,3],[1,4],[2,4],[3,4]], dirgraph(G,V,E), path(G, 4, 1).
No.

?- V`::[]..[1,2,3,4], E`::[]..[[1,2],[1,3],[1,4],[2,4],[3,4]], dirgraph(G,V,E), path(G, 1, 4), graph_labeling(G).
V = [1, 4]
E = [[1, 4]]
G = dirgraph([1, 4], [[1, 4]])
Yes ? ;

V = [1, 3, 4]
E = [[1, 3], [3, 4]]
G = dirgraph([1, 3, 4], [[1, 3], [3, 4]])
Yes ? ;

V = [1, 2, 4]
E = [[1, 2], [2, 4]]
G = dirgraph([1, 2, 4], [[1, 2], [2, 4]])
Yes

?- V`::[]..[1,2,3,4], E`::[]..[[1,2],[1,3],[1,4],[2,1],[2,4],[3,1],[3,4],[4,1],[4,2],[4,3]], undirgraph(G,V,E), path(G, 1, 4), graph_labeling(G).
V = [1, 3, 4]
E = [[1, 3], [3, 1], [3, 4], [4, 3]]
G = undirgraph([1, 3, 4], [[1, 3], [3, 1], [3, 4], [4, 3]])
Yes ? ;

V = [1, 3, 4]
E = [[1, 3], [1, 4], [3, 1], [3, 4], [4, 1], [4, 3]]
G = undirgraph([1, 3, 4], [[1, 3], [1, 4], [3, 1], [3, 4], [4, 1], [4, 3]])
Yes ? ;

V = [1, 2, 4]
E = [[1, 2], [2, 1], [2, 4], [4, 2]]
G = undirgraph([1, 2, 4], [[1, 2], [2, 1], [2, 4], [4, 2]])
Yes ? ;

V = [1, 2, 4]
E = [[1, 2], [1, 4], [2, 1], [2, 4], [4, 1], [4, 2]]
G = undirgraph([1, 2, 4], [[1, 2], [1, 4], [2, 1], [2, 4], [4, 1], [4, 2]])
Yes ? ;

V = [1, 2, 3, 4]
E = [[1, 2], [1, 3], [2, 1], [2, 4], [3, 1], [3, 4], [4, 2], [4, 3]]
G = undirgraph([1, 2, 3, 4], [[1, 2], [1, 3], [2, 1], [2, 4], [3, 1], [3, 4], [4, 2], [4, 3]])
Yes
```