Drawing a directed graph in Maple

662 Views Asked by At

I have been playing around with some Maple today for a semigroup/ graph theory style project. I want to draw a left cayley graph with vertices $\{1,....,12\}$ and edges $[5, 5]$, $\{[6, 2].[7, 1], [1, 3], [1, 5], [2, 4], [2, 6], [3, 5], [3, 7], [4, 5], [4, 8], [6, 9], [7, 5], [8, 5], [8, 10], [9, 5], [9, 11], [10, 4], [10, 5], [11, 5], [11, 12], [12, 5], [12, 9]\}$

This is a directed graph; e.g. $[6, 2]$ means I want $6\rightarrow2$ as an edge.

I tried the command:

S := Graph([5, 5], {[6, 2].[7, 1], [1, 3], [1, 5], [2, 4], [2, 6], [3, 5], [3, 7], [4, 5], [4, 8], [6, 9], [7, 5], [8, 5], [8, 10], [9, 5], [9, 11], [10, 4], [10, 5], [11, 5], [11, 12], [12, 5], [12, 9]})

However, I get the error message:

"Error, (in GraphTheory:-Graph) vertices must have distinct labels "

How can I fix this? If someone could give me a code that would produce this graph, I would be forever grateful.

Thank you

Grant

EDIT: So the problem was resolved; it was a period between the first 2 edges, silly me. However, I now have a second question: Is there a way it can be set up that Maple gives me the "neatest" looking layout of the vertices to make the graph look the most appealing? For example, with the code above it just lays out 1 to 12 in a circle and looks pretty messy.

1

There are 1 best solutions below

0
On

As discussed in the comments, remove the loop edge and correct the period that should be a comma. Then construct the graph S with your GraphTheory:-Graph command. Then issue the command

GraphTheory:-DrawGraph(S, style= spring, redraw, dimension= 3);

Then click on the graph. Enlarge it by stretching the bounding box in both directions. Right click on the plot. Go to the Manipulator submenu. Select Rotate. Now use your mouse to rotate the plot into the best view. You should be able to clearly see three tetrehedra that share a single vertex, 5. There are only two other vertices, 2 and 6, and they are on a path connecting vertices 4 and 9.

If you can't see all that, issue the DrawGraph command again: There is a small amount of randomness in the spring algorithm, and you may get a better plot.