Graph Theory - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.

Online Help

All Products    Maple    MapleSim


GraphTheory

Maple 2019 enhances the GraphTheory package with new functions, including:

• 

FindVertexCover, MinimumVertexCover

• 

FindHamiltonianCycle, FindHamiltonianPath

• 

GreedyClique, GreedyIndependentSet

• 

IsStronglyRegular

• 

IsTriangleFree

• 

TransitiveReduction

• 

BarabasiAlbertGraph

• 

WattsStrogatzGraph

The SpecialGraphs subpackage also includes commands for eleven new graphs and many new options for customizing the visualizations of graphs have been added to the DrawGraph command.

 

 

Examples

New Special Graphs

New Visualization Options

Examples

FindVertexCover

FindVertexCover returns a list of vertices which comprise a vertex cover  in the graph G. The optional parameter size specifies a size for the clique.

> 

with⁡GraphTheory:

> 

G≔CompleteGraph3,4

G≔Graph 1: an undirected unweighted graph with 7 vertices and 12 edge(s)

(1.1.1)
> 

DrawGraph⁡G

> 

FindVertexCoverG,3

1,2,3

(1.1.2)
> 

FindVertexCoverG,4

4,5,6,7

(1.1.3)

MaximumClique

MaximumClique returns a clique of the largest possible size in the specified graph. Maple 2019 includes a new heuristic, method=sat, which transforms the graph into an instance of the Boolean satisfiability problem which it then solves using the Logic[Satisfy] command.
The new default heuristic, method=hybrid, runs the two methods optimal and sat in parallel and returns the result of whichever method finishes first.

> 

M≔SpecialGraphs:-MirzakhaniGraph

M≔Graph 2: an undirected unweighted graph with 63 vertices and 183 edge(s)

(1.2.1)
> 

MaximumCliqueM,method=sat

61,62,63

(1.2.2)

WattsStrogatzGraph

The WattsStrogatzGraph command permits the generation of random graphs with the Watts-Strogatz model, which produces graphs with a number of desirable real-world properties such as short average path lengths and high clustering.

> 

WSG ≔ RandomGraphs:-WattsStrogatzGraph20,0.2

WSG≔Graph 3: an undirected unweighted graph with 20 vertices and 40 edge(s)

(1.3.1)
> 

DrawGraphWSG, style=spring

 

New Special Graphs

The SpecialGraphs subpackage now includes built-in commands to generate the following special graphs or graph families:

> 

withSpecialGraphs:

Brinkmann Graph

Cameron Graph

Circulant Graph

Dürer Graph

> 

DrawGraphBrinkmannGraph,style=spring, size=250,250

> 

CG ≔ CameronGraph

CG≔Graph 4: an undirected unweighted graph with 231 vertices and 3465 edge(s)

(2.1)
> 

NumberOfVerticesCG

231

(2.2)
> 

NumberOfEdgesCG

3465

(2.3)
> 

DrawGraphCirculantGraph7,3, size=250,250

> 

DrawGraph DuererGraph, size=250,250

Friendship Graph

Hall-Janko Graph

Johnson Graph

Livingstone Graph

> 

DrawGraphFriendshipGraph5, size=250,250

> 

HJG ≔ HallJankoGraph

HJG≔Graph 5: an undirected unweighted graph with 100 vertices and 1800 edge(s)

(2.4)
> 

NumberOfVerticesHJG;

100

(2.5)
> 

NumberOfEdgesHJG;

1800

(2.6)
> 

DrawGraphJohnsonGraph4,2, size=250,250

> 

LG ≔ LivingstoneGraph

LG≔Graph 6: an undirected unweighted graph with 266 vertices and 198 edge(s)

(2.7)
> 

GirthLG

5

(2.8)

Suzuki Graph

Sylvester Graph

Tietze Graph

> 

SG ≔SuzukiGraph

SG≔Graph 7: an undirected unweighted graph with 1782 vertices and 370656 edge(s)

(2.9)
> 

NumberOfEdgesSG

370656

(2.10)
> 

DrawGraph SylvesterGraph,style=spring, showlabels=false,size=250,250

> 

DrawGraph TietzeGraph, size=250,250

New Visualization Options

The DrawGraph command and various graph highlighting commands have been enhanced with even more new ways to customize graph display. Some of the defaults have changed so that the vertex shape will generally be closer to the size of the vertex label, vertex borders will not overlap, and the size option passed to DrawGraph will be used to make graphs look better at sizes different than the default. As well, the arrows on directed edges are now draw with a more typical solid triangle shape with new stylesheet options to customize the arrow positions and size.

> 

GV1 ≔Graph1,2,1, 2,3,2, 3,4,3, 4,5,4, 5,1,5;

GV1≔Graph 8: a directed weighted graph with 5 vertices and 5 arc(s)

(3.1)
> 

DrawGraphGV1, stylesheet=edgethickness=3, vertexcolor=Red, arrowpos=0.1,arrowsize=25,weightfontsize=25,vertexfontsize=25

A new vertex shape option is now available as well, the shape can be any string understood by the new command plottools:-polygonbyname.

> 

DrawGraphGV1, stylesheet=vertexshape=hexagon

> 

HighlightVertexGV1, 2,  stylesheet=shape=star; DrawGraphGV1

There is a new option to control the amount of padding (measured in font points) around vertex labels.  This is useful if the automatically selected size of the vertex shape is too large or too small.

> 

HighlightVertexGV1, 2,  stylesheet=shape=star, padding=−3;HighlightVertexGV1, 3,  stylesheet=padding=10;DrawGraphGV1

There is a new option to set the line style of graph edges.  Any linestyle from plot/options is supported.

> 

HighlightEdgesGV1, 1,2,  stylesheet=linestyle=dashdot; DrawGraphGV1 

In cases where the graph has many vertices, labels are turned off by default but plot annotations are added so that you can see the labels when you hover the mouse pointer over a vertex.

> 

TV1 ≔ RandomGraphs:-RandomTree100; DrawGraphTV1

TV1≔Graph 9: an undirected unweighted graph with 100 vertices and 99 edge(s)

(3.2)

The DrawGraph tree style can now be used on graphs that are not trees. This is implemented by choosing a vertex layout based on the SpanningTree starting at a specified root.

> 

GV2 ≔CompleteGraph5,2; DrawGraphGV2, style=tree, root=3

GV2≔Graph 16: an undirected unweighted graph with 7 vertices and 10 edge(s)