 IsTriangleFree - Maple Help

GraphTheory

 IsTriangleFree
 test if graph is triangle-free Calling Sequence IsTriangleFree(G,opts) Parameters

 G - graph opts - (optional) equation of the form usecached=true or usecached=false Options

 • usecached : keyword option of the form usecached=true or usecached=false. This specifies whether a previously stored clique number should be used, if available. The default is true. Description

 • The IsTriangleFree(G) command returns true if G is a triangle-free graph and false otherwise. Definition

 • An undirected graph G is triangle-free if it does not contain any cycle of length 3. This is equivalent to stating the clique number of G is less than 3. Examples

 > $\mathrm{with}\left(\mathrm{GraphTheory}\right):$
 > $\mathrm{with}\left(\mathrm{SpecialGraphs}\right):$
 > $G≔\mathrm{Graph}\left(\left\{\left\{1,2\right\},\left\{1,3\right\},\left\{2,3\right\},\left\{3,4\right\}\right\}\right)$
 ${G}{≔}{\mathrm{Graph 1: an undirected unweighted graph with 4 vertices and 4 edge\left(s\right)}}$ (1)
 > $\mathrm{IsTriangleFree}\left(G\right)$
 ${\mathrm{false}}$ (2)
 > $P≔\mathrm{PetersenGraph}\left(\right)$
 ${P}{≔}{\mathrm{Graph 2: an undirected unweighted graph with 10 vertices and 15 edge\left(s\right)}}$ (3)
 > $\mathrm{IsTriangleFree}\left(P\right)$
 ${\mathrm{true}}$ (4)
 > $\mathrm{DrawGraph}\left(P\right)$ > $C≔\mathrm{ClebschGraph}\left(\right)$
 ${C}{≔}{\mathrm{Graph 3: an undirected unweighted graph with 16 vertices and 40 edge\left(s\right)}}$ (5)
 > $\mathrm{IsTriangleFree}\left(C\right)$
 ${\mathrm{true}}$ (6)
 > $\mathrm{DrawGraph}\left(C\right)$  Compatibility

 • The GraphTheory[IsTriangleFree] command was introduced in Maple 2019.