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 2023, including improved ability to solve traveling salesman problems, support for multigraphs, new commands for graph computation, and advances in visualization.

 

Traveling Salesman

Multigraph support

Graph products

Additions to SpecialGraphs

Traveling Salesman

The TravelingSalesman command now makes use of Concorde, a well-known library implementing highly efficient heuristics for solving instances of the traveling salesman problem. This addition considerably increases the size of problems which TravelingSalesman is able to handle.

Example: Using TravelingSalesman with vertexpositions

In the following example, we import a dataset of the 100 largest cities in the continent of Africa (including the island of Madagascar) and ask TravelingSalesman to find a minimal tour of them.

(1.1.1)

With the new vertexpositions option, TravelingSalesman uses edge weights computed from the geometric distance between vertices in the graph layout specified previously when CompleteGraph was called. The new startvertex option allows a particular starting vertex to be specified.

(1.1.2)

 

We will illustrate the tour by constructing a subgraph consisting only of the edges included in the optimal tour across G.

(1.1.3)

To better visualize the tour we can combine this with a country map of Africa.

Using TravelingSalesman with an arbitrary weight matrix

The previous example demonstrates the use of TravelingSalesman with edge weights corresponding directly to geometric distances between vertices.  In many instances of the traveling salesman problem, the weights do not correspond so directly to the geometry.

Fortunately, TravelingSalesman can also compute a tour when given an arbitrary weight matrix. To illustrate this, let us extend the previous example of a tour of 100 African cities to incorporate the idea that there might be some increased cost associated with traversing an international border.

First let us get the matrix of Euclidean distances from the previous example:

Now we can construct a new weight matrix  in which the weight is doubled whenever the cities connected are in distinct countries.

We can now pass the weight matrix  directly to TravelingSalesman to get a new tour.

(1.2.1)

(1.2.2)

This new tour is similar to the previous one in many respects, but notably does not visit Sudan or the Democratic Republic of the Congo twice as the first one did, illustrating the effect of our increased edge weights.

Finally we can draw the original tour (in green) and the new tour (in red) to see the effect of the altered weights.

 

Multigraph support

GraphTheory now supports multigraphs. That is, graphs in which there may be multiple edges between the same pair of vertices.

(2.1)

The new command IsMultigraph tests whether a graph is a multigraph.

(2.2)

Many other commands have been updated to support multigraphs.

The Edges command for this graph returns a list, not a set, and repeats the edge between vertices 3 and 4 twice.

(2.3)

(2.4)

Graph visualization commands such as DrawGraph will draw an integer weight on edges for which the edge multiplicity is greater than 1.

 

Graph products

A graph product is a binary operation on graphs which takes two graphs  and  and produces a graph  with the following properties:

• 

The vertex set of H is the Cartesian product  where  and  are the vertex sets of  and , respectively.

(3.1)
• 

Two vertices  and  of  are connected by an edge, iff some condition about  and  is fulfilled.


Many different graph products have been defined which differ in the condition imposed on the edges. To the existing CartesianProduct and TensorProduct commands, the following new graph products have been added:

Name

Edge Condition

ConormalProduct

 and  share an edge in  or  and  share an edge in

LexicographicProduct

 and  share an edge in , or  in  and  and  share an edge in


ModularProduct

 and  share an edge in  and  and  share an edge in ,
or  and  do not share an edge in  and  and  do not share an edge in


StrongProduct

 in  and  and  share an edge in ,
or  and  share an edge in  and  in
or  and  share an edge in  and  and  share an edge in

 

(3.2)

(3.3)

(3.4)

Additions to SpecialGraphs

Maple 2023 provides support for 6 additional Special Graphs, bringing the total to 119.  

Bishops's Graph

Bouquet Graph

Dipole Graph

(4.1.1)

(4.1.2)

(4.1.3)

Hamming Graph

 House Graph

 Windmill Graph

(4.1.4)

(4.1.5)

(4.1.6)


Download Help Document