 GraphTheory - Maple Programming Help

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

GraphTheory

 CycleGraph
 PathGraph

 Calling Sequence CycleGraph(n) CycleGraph(V) PathGraph(n) PathGraph(V)

Parameters

 n - positive integer V - list of vertices

Description

 • CycleGraph(n) outputs a graph which is a cycle on n vertices labeled 1, 2, ..., n.
 • PathGraph(n) outputs a graph which is a path on n vertices labeled 1, 2, ..., n.
 • In both cases you can input the labels for the vertices as a list of integers, strings, or symbols.

Examples

 > $\mathrm{with}\left(\mathrm{GraphTheory}\right):$
 > $C≔\mathrm{CycleGraph}\left(4\right)$
 ${C}{≔}{\mathrm{Graph 1: an undirected unweighted graph with 4 vertices and 4 edge\left(s\right)}}$ (1)
 > $\mathrm{Edges}\left(C\right)$
 $\left\{\left\{{1}{,}{2}\right\}{,}\left\{{1}{,}{4}\right\}{,}\left\{{2}{,}{3}\right\}{,}\left\{{3}{,}{4}\right\}\right\}$ (2)
 > $\mathrm{DrawGraph}\left(C\right)$ > $P≔\mathrm{PathGraph}\left(\left[a,b,c,d\right]\right)$
 ${P}{≔}{\mathrm{Graph 2: an undirected unweighted graph with 4 vertices and 3 edge\left(s\right)}}$ (3)
 > $\mathrm{Edges}\left(P\right)$
 $\left\{\left\{{a}{,}{b}\right\}{,}\left\{{b}{,}{c}\right\}{,}\left\{{c}{,}{d}\right\}\right\}$ (4)
 > $\mathrm{DrawGraph}\left(P\right)$ 