 GraphTheory - Maple Programming Help

Home : Support : Online Help : Mathematics : Discrete Mathematics : Graph Theory : GraphTheory Package : GraphTheory/IsReachable

GraphTheory

 IsReachable
 determine if there is a path between two vertices

 Calling Sequence IsReachable(G, u, v)

Parameters

 G - graph u, v - vertices of the graph

Description

 • IsReachable returns true or false indicating whether there exists a path from u to v in the graph G.
 • To list all vertices reachable from u, use Reachable.
 • To produce an actual path from u to v, use BellmanFordAlgorithm, DijkstrasAlgorithm, or ShortestPath.

Examples

 > $\mathrm{with}\left(\mathrm{GraphTheory}\right):$
 > $\mathrm{C6}≔\mathrm{CycleGraph}\left(6\right)$
 ${\mathrm{C6}}{≔}{\mathrm{Graph 1: an undirected unweighted graph with 6 vertices and 6 edge\left(s\right)}}$ (1)
 > $\mathrm{IsReachable}\left(\mathrm{C6},1,5\right)$
 ${\mathrm{true}}$ (2)
 > $\mathrm{ShortestPath}\left(\mathrm{C6},1,5\right)$
 $\left[{1}{,}{6}{,}{5}\right]$ (3)

Compatibility

 • The GraphTheory[IsReachable] command was introduced in Maple 2018.