 Reachable - Maple Help

GraphTheory

 Reachable
 determine vertices reachable from a given vertex Calling Sequence Reachable(G, v) Reachable(G, v, opts) Parameters

 G - graph v - vertex of the graph opts - (optional) one or more options as specified below Options

 • output=one of graph or list
 Specifies whether the result should be a list of vertices reachable from v or the subgraph induced by the vertices reachable from v. The default is list. Description

 • Reachable returns a list of all vertices reachable from the vertex v in the graph G.
 • To produce an actual spanning tree of vertices reachable from v, see SpanningTree or MinimalSpanningTree. Definition

 • 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.
 • 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. Examples

 > $\mathrm{with}\left(\mathrm{GraphTheory}\right):$
 > $\mathrm{C6}≔\mathrm{CycleGraph}\left(6\right)$
 ${\mathrm{C6}}{≔}{\mathrm{Graph 1: an undirected graph with 6 vertices and 6 edge\left(s\right)}}$ (1)
 > $\mathrm{Reachable}\left(\mathrm{C6},1\right)$
 $\left[{1}{,}{2}{,}{3}{,}{4}{,}{5}{,}{6}\right]$ (2)
 > $G≔\mathrm{Graph}\left(5,\left\{\left[1,2\right],\left[2,3\right],\left\{1,4\right\},\left\{4,5\right\}\right\}\right)$
 ${G}{≔}{\mathrm{Graph 2: a directed graph with 5 vertices and 6 arc\left(s\right)}}$ (3)
 > $\mathrm{Reachable}\left(G,2\right)$
 $\left[{2}{,}{3}\right]$ (4)
 > $\mathrm{Reachable}\left(G,2,\mathrm{output}=\mathrm{graph}\right)$
 ${\mathrm{Graph 3: a directed graph with 2 vertices and 1 arc\left(s\right)}}$ (5) Compatibility

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