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

Online Help

All Products    Maple    MapleSim


GraphTheory

A substantial effort was put into Graph Theory for Maple 2024, including new commands for graph computation and generation.

withGraphTheory:

 

New commands

New functionality for existing commands

Additions to SpecialGraphs

New commands

These commands are new for Maple 2024:

AllGraphs

Condensation

FindAsteroidalTriple

IsArchimedeanGraph

IsAsteroidalTripleFree

IsDominatingSet

IsIndependentSet

MinCut

MoralGraph

RelationGraph

WienerIndex

 

AllGraphs

The new AllGraphs command returns an iterator with which one can step through all graphs matching a particular set of criteria, such as vertex count or edge count. It is also possible to cause the Iterator to return only connected graphs or only graphs which are not isomorphic to a graph previously returned by this Iterator.

iterator  AllGraphsvertices=3, nonisomorphic

iterator

(1.1.1)

iterator:-getNext

Graph 1: an undirected graph with 3 vertices and 0 edge(s)

(1.1.2)

iterator:-getNext

Graph 2: an undirected graph with 3 vertices and 1 edge(s)

(1.1.3)

iterator:-getNext

Graph 3: an undirected graph with 3 vertices and 2 edge(s)

(1.1.4)

Condensation

The new command Condensation computes the condensation of a given (directed) graph.

The condensation of a graph G is a graph C whose vertices correspond to the strongly connected components of G.  The condensation C will have an arc from u to v whenever there is an arc from the strongly connected component of G corresponding to u to the strongly connected component of G corresponding to v.

T  Digraph 4, 1,2,1,3,2,3,3,2,4,3 

TGraph 4: a directed graph with 4 vertices and 5 arc(s)

(1.2.1)

C  CondensationT

CGraph 5: a directed graph with 3 vertices and 2 arc(s)

(1.2.2)

DrawGraph~T|C, stylesheet = vertexpadding = 20

PLOT...PLOT...

(1.2.3)

FindAsteroidalTriple and IsAsteroidalTripleFree

The new command FindAsteriodalTriple searches for an asteroidal triple in the given graph.  The related new command IsAsteroidalTripleFree returns true when the given graph does not contain an asteroidal triple.

An asteroidal triple for a graph G is a triple u,v,w of non-adjacent vertices of G such that for each pair from the triple, there exists a path between them that does not intersect the third vertex or any of its neighbors.

C6  CycleGraph6

C6Graph 6: an undirected graph with 6 vertices and 6 edge(s)

(1.3.1)

DrawGraphC6,size=200,200

FindAsteroidalTripleC6

1,3,5

(1.3.2)

IsArchimedeanGraph

The new command IsArchimedeanGraph tests whether a given graph is an Archimedean graph.

The Archimedean graphs are those graphs which form the skeletons of the Archimedean solids. The Archimedean solids comprise 13 convex polyhedra whose faces are regular polygons and whose vertices are all symmetric to each other, but which are not Platonic solids (polyhedra whose faces are identical).  

IsArchimedeanGraph SpecialGraphs:-SnubCubeGraph 

true

(1.4.1)

IsDominatingSet

The new command IsDominatingSet tests whether a set is a dominating set for a given graph.

A dominating set of a graph G is a subset S of the vertices of G, with the condition that every vertex in G must either be an element of S or the neighbor of an element of S.

P5  PathGraph5

P5Graph 7: an undirected graph with 5 vertices and 4 edge(s)

(1.5.1)

 S3  1,3,5

S31,3,5

(1.5.2)

IsDominatingSet P5, S3 ; 

true

(1.5.3)

MinCut

The new MinCut command works per the Max-Flow Min-Cut Theorem and uses the flow output to compute a cut-set. The EdgeConnectivity and VertexConnectivity commands have been updated to use MinCut so that they can now also return cut-sets.

MG  Graph1,2,1,3,2,3,2,4,3,4,3,5,3,6,3,7,4,7

MGGraph 8: an undirected graph with 7 vertices and 9 edge(s)

(1.6.1)

mf,flowM MaxFlowMG, 2, 7;i

mf,flowM2,?

i

(1.6.2)

The MinCut command will call MaxFlow by default but can reuse the flow matrix if MaxFlow has been called already.

MinCutMG, 2, 7,flows=flowM;

3,7,4,7

(1.6.3)

EdgeConnectivityMG,output=cutset;

3,5

(1.6.4)

VertexConnectivityMG,output=cutset; 

3

(1.6.5)

MoralGraph

The moral graph of a directed graph G is a graph M with the same vertices as G but with all directed edges made undirected, and with the property that whenever two directed edges in G share a destination vertex, then their source vertices are connected in M.

The new command MoralGraph constructs the moral graph given a directed graph.

DG  Graph 7, 1,3,2,3,2,4,3,5,3,6,3,7,4,7 ,vertexpositions=1,2,2,2,1,1,2,1,0,0,1,0,2,0

DGGraph 9: a directed graph with 7 vertices and 7 arc(s)

(1.7.1)

NumberOfEdgesDG

7

(1.7.2)

MG MoralGraph DG 

MGGraph 10: an undirected graph with 7 vertices and 9 edge(s)

(1.7.3)

NumberOfEdgesMG

9

(1.7.4)

SetVertexPositionsMG,GetVertexPositionsDG

plots:-displayDrawGraph~DG|MG

RelationGraph

The RelationGraph command constructs a graph on a given vertex list in which an edge is present in the graph whenever a particular Boolean predicate on its two vertices is true.

RG  RelationGraph seq1..16, NumberTheory:-AreCoprime 

RGGraph 11: an undirected graph with 16 vertices and 79 edge(s)

(1.8.1)

DrawGraphRG

In this example, the neighborhood of the element 5 will be all those vertices whose values are coprime with 5:

Neighborhood RG, 5 

1,2,3,4,6,7,8,9,11,12,13,14,16

(1.8.2)

WienerIndex

The WienerIndex command computes the Wiener index on a given graph. The Wiener index of a graph is the sum of the lengths of the shortest paths between all pairs of vertices in the graph.

G  CycleGraph20

GGraph 12: an undirected graph with 20 vertices and 20 edge(s)

(1.9.1)

WienerIndexG

40

(1.9.2)

New functionality for existing commands

Distance and ShortestPath

The Distance and ShortestPath commands now use the edge weights of a weighted matrix. They both have a new option ignoreweights to compute the distance or shortest path in the underlying unweighted graph.

W6  Graph 1, 2,10, 1, 6,6, 2, 3,10, 3, 4,10, 4, 5,10, 5, 6,5 ;

W6Graph 13: a directed weighted graph with 6 vertices and 6 arc(s)

(2.1.1)

DrawGraphW6, layout=circle;

ShortestPathW6, 1, 6;

1,2,3,4,5,6

(2.1.2)

DistanceW6, 1, 6;

5

(2.1.3)

ShortestPathW6, 1, 6, 'ignoreweights';

1,6

(2.1.4)

DistanceW6, 1, 6, 'ignoreweights';

1

(2.1.5)

MaxFlow

The MaxFlow command now works on all graphs.  It now treats an unweighted graph as a graph with all edge weights equal to 1, or to the edge multiplicity for multigraphs.

 

Additions to SpecialGraphs

The SpecialGraphs subpackage now includes commands for all the Archimedean graphs, as well as the Möbius ladder graph and the Wagner graph.

Archimedean Graphs

The Archimedean graphs are those graphs which form the skeletons of the Archimedean solids.  The Archimedean solids comprise 13 convex polyhedra whose faces are regular polygons and whose vertices are all symmetric to each other, but which are not Platonic solids (polyhedra whose faces are identical). They were first enumerated by Archimedes.

The new command IsArchimedeanGraph tests whether a given graph is an Archimedean graph.

The following new commands generate each of the Archimedean graphs.

Archimedean solid

Degree

Vertices 

Edges 

Command

2-D 

3-D 

truncated tetrahedon

3

12

18 

G  SpecialGraphs:-TruncatedTetrahedronGraph;

GGraph 14: an undirected graph with 12 vertices and 18 edge(s)

(3.1.1)

DrawPlanarG,showlabels=false

DrawGraphG, dimension=3 

cuboctahedron

4

12

24

letters    seqABCDEFGHIJKL 

lettersA,B,C,D,E,F,G,H,I,J,K,L

(3.1.2)

 G  SpecialGraphs:-CuboctahedronGraphletters 

GGraph 15: an undirected graph with 12 vertices and 24 edge(s)

(3.1.3)

DrawPlanarG,showlabels=false 

DrawGraphG, dimension=3 

truncated cube

3

24

36

G  SpecialGraphs:-TruncatedCubeGraph

GGraph 16: an undirected graph with 24 vertices and 36 edge(s)

(3.1.4)

DrawPlanarG,showlabels=false

DrawGraphG, dimension=3 

truncated octahedron

3

24

36

G  SpecialGraphs:-TruncatedOctahedronGraph

GGraph 17: an undirected graph with 24 vertices and 36 edge(s)

(3.1.5)

DrawPlanarG,showlabels=false

DrawGraphG, dimension=3 

small rhombicuboctahedron

4

24

48

G  SpecialGraphs:-SmallRhombicuboctahedronGraph

GGraph 18: an undirected graph with 24 vertices and 48 edge(s)

(3.1.6)

DrawPlanarG,showlabels=false

DrawGraphG, dimension=3 

great rhombicuboctahedron
(also called truncated cuboctahedron)

3

48

72

G  SpecialGraphs:-GreatRhombicuboctahedronGraph

GGraph 19: an undirected graph with 48 vertices and 72 edge(s)

(3.1.7)

DrawPlanarG,showlabels=false

DrawGraphG, dimension=3 

snub cube

5

24

60

G  SpecialGraphs:-SnubCubeGraph

GGraph 20: an undirected graph with 24 vertices and 60 edge(s)

(3.1.8)

DrawPlanarG,showlabels=false

DrawGraphG, dimension=3 

Icosidodecahedron

4

30

60

G  SpecialGraphs:-IcosidodecahedronGraph

GGraph 21: an undirected graph with 30 vertices and 60 edge(s)

(3.1.9)

DrawPlanarG,showlabels=false

DrawGraphG, dimension=3 

truncated dodecahedron

3

60

90

G  SpecialGraphs:-TruncatedDodecahedronGraph

GGraph 22: an undirected graph with 60 vertices and 90 edge(s)

(3.1.10)

DrawPlanarG,showlabels=false

DrawGraphG, dimension=3 

truncated icosahedron

3

60

90

G  SpecialGraphs:-TruncatedIcosahedronGraph

GGraph 23: an undirected graph with 60 vertices and 90 edge(s)

(3.1.11)

DrawPlanarG,showlabels=false

DrawGraphG, dimension=3 

small rhombicosidodecahedron

4

60

120

G  SpecialGraphs:-SmallRhombicosidodecahedronGraph

GGraph 24: an undirected graph with 60 vertices and 120 edge(s)

(3.1.12)

DrawPlanarG,showlabels=false

DrawGraphG, dimension=3 

great rhombicosidodecahedron
(also called truncated icosidodecahedron)

3

120

180

G  SpecialGraphs:-GreatRhombicosidodecahedronGraph

GGraph 25: an undirected graph with 120 vertices and 180 edge(s)

(3.1.13)

DrawPlanarG, showlabels=false

DrawGraphG, dimension=3 

snub dodecahedron

5

60

150

 G  SpecialGraphs:-SnubDodecahedronGraph

GGraph 26: an undirected graph with 60 vertices and 150 edge(s)

(3.1.14)

 DrawPlanarG, showlabels=false

DrawGraphG, dimension=3 

Möbius ladder graph and Wagner graph

The Möbius ladder graph on 2 n vertices may be understood visually as the ladder graph on the same vertices, with the addition of two edges: one connecting the left-hand side of the "op rung to the right-hand side of the bottom rung, and one connecting the right-hand side of the top rung to the left-hand side of the bottom rung.

 WG :ML3  SpecialGraphs:-MoebiusLadderGraph3

ML3Graph 27: an undirected graph with 6 vertices and 9 edge(s)

(3.2.1)

 DrawGraphML3, stylesheet = vertexpadding = 8

The Wagner graph is a 3-regular graph which is a particular instance of an Möbius ladder graph on 8 vertices.

WG  SpecialGraphs:-WagnerGraph

WGGraph 28: an undirected graph with 8 vertices and 12 edge(s)

(3.2.2)

 DrawGraphWG, stylesheet = vertexpadding = 8