GraphTheory
IsReachable
determine if there is a path between two vertices
Calling Sequence
Parameters
Description
Definition
Examples
Compatibility
IsReachable(G, u, v)
G
-
graph
u, v
vertices of the graph
IsReachable(G, u, v) returns a true when the vertex v is reachable from u in the graph G.
To produce an actual path (or directed path when G is directed) from u to v, use BellmanFordAlgorithm, DijkstrasAlgorithm, or ShortestPath.
To find all vertices reachable from u, use Reachable.
If G is an undirected graph, a vertex w is said to be reachable from a vertex v if there exists a path in G between v and w. This is true if and only if they are in the same connected component.
If G is a directed graph, a vertex w is said to be reachable from a vertex v if there exists a directed path in G from v to w.
with⁡GraphTheory:
C6 ≔ CycleGraph⁡6
C6≔Graph 1: an undirected graph with 6 vertices and 6 edge(s)
IsReachable⁡C6,1,5
true
ShortestPath⁡C6,1,5
1,6,5
With the following example we see that the reachability relation is not symmetric for directed graphs.
DP4 ≔ Graph⁡A,B,C,D,A,B,B,C,C,D
DP4≔Graph 2: a directed graph with 4 vertices and 3 arc(s)
IsReachable⁡DP4,A,D
ShortestPath⁡DP4,A,D
A,B,C,D
IsReachable⁡DP4,D,A
false
The GraphTheory[IsReachable] command was introduced in Maple 2018.
For more information on Maple 2018 changes, see Updates in Maple 2018.
See Also
BellmanFordAlgorithm
DijkstrasAlgorithm
Reachable
ShortestPath
Download Help Document
What kind of issue would you like to report? (Optional)