 GraphTheory - Maple Programming Help

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

GraphTheory

 Trail

 Calling Sequence Trail(vseq)

Parameters

 vseq - list or sequence of vertices

Description

 • The Trail inert function is used as a short form description of edges in a graph passing through a vertex sequence/list in the given order. For example, Trail(1,2,3,4) or Trail([1,2,3,4]) are short forms to specify a trail through the vertices that generates the edges $\left[1,2\right]$, $\left[2,3\right]$ and $\left[3,4\right]$.
 • The Trail function is only understood by the functions that construct graphs (Graph and Digraph) as well as functions that add edges to a graph or remove edges from a graph (AddEdge, DeleteEdge, AddArc, and DeleteArc). It is also used as a return value for a specified path (IsEulerian).

Examples

 > $\mathrm{with}\left(\mathrm{GraphTheory}\right):$
 > $G≔\mathrm{Graph}\left(4,\mathrm{Trail}\left(1,2,3,4,1\right)\right)$
 ${G}{≔}{\mathrm{Graph 1: an undirected unweighted graph with 4 vertices and 4 edge\left(s\right)}}$ (1)
 > $\mathrm{Edges}\left(G\right)$
 $\left\{\left\{{1}{,}{2}\right\}{,}\left\{{1}{,}{4}\right\}{,}\left\{{2}{,}{3}\right\}{,}\left\{{3}{,}{4}\right\}\right\}$ (2)
 > $G≔\mathrm{Digraph}\left(4,\mathrm{Trail}\left(1,2,3,4,1\right)\right)$
 ${G}{≔}{\mathrm{Graph 2: a directed unweighted graph with 4 vertices and 4 arc\left(s\right)}}$ (3)
 > $\mathrm{Edges}\left(G\right)$
 $\left\{\left[{1}{,}{2}\right]{,}\left[{2}{,}{3}\right]{,}\left[{3}{,}{4}\right]{,}\left[{4}{,}{1}\right]\right\}$ (4)
 > $G≔\mathrm{Graph}\left(4\right)$
 ${G}{≔}{\mathrm{Graph 3: an undirected unweighted graph with 4 vertices and 0 edge\left(s\right)}}$ (5)
 > $\mathrm{AddEdge}\left(G,\mathrm{Trail}\left(1,2,3,4,1\right),'\mathrm{inplace}'=\mathrm{true}\right)$
 ${\mathrm{Graph 3: an undirected unweighted graph with 4 vertices and 4 edge\left(s\right)}}$ (6)
 > $\mathrm{Edges}\left(G\right)$
 $\left\{\left\{{1}{,}{2}\right\}{,}\left\{{1}{,}{4}\right\}{,}\left\{{2}{,}{3}\right\}{,}\left\{{3}{,}{4}\right\}\right\}$ (7)
 > $\mathrm{IsEulerian}\left(G,'T'\right)$
 ${\mathrm{true}}$ (8)
 > $T$
 ${\mathrm{Trail}}{}\left({1}{,}{2}{,}{3}{,}{4}{,}{1}\right)$ (9)
 > $G≔\mathrm{Digraph}\left(4\right)$
 ${G}{≔}{\mathrm{Graph 4: a directed unweighted graph with 4 vertices and 0 arc\left(s\right)}}$ (10)
 > $\mathrm{AddArc}\left(G,\mathrm{Trail}\left(4,3,2,1,4\right),'\mathrm{inplace}'=\mathrm{true}\right)$
 ${\mathrm{Graph 4: a directed unweighted graph with 4 vertices and 4 arc\left(s\right)}}$ (11)
 > $\mathrm{Edges}\left(G\right)$
 $\left\{\left[{1}{,}{4}\right]{,}\left[{2}{,}{1}\right]{,}\left[{3}{,}{2}\right]{,}\left[{4}{,}{3}\right]\right\}$ (12)