Is there software I can use to draw this graph?

466 Views Asked by At

So, I have this particular graph to consider. It has the vertex set $\{1,...,17\}$ and edge set $\{(i,j)|i+j ~\mbox{is prime}\}$. Define a cost function $c:E(G)\mapsto \mathbb{R}$ by setting $c((i,j))=i+j$. Apply Kruskal's algorithm to find a minimum cost spanning tree of $G$. Now, I know how to do this but drawing the graph by hand and connecting vertices is rather tedious. In fact, it's pretty much impossible for me because of the large number of vertices. Is there any software I can draw this graph to be able to see things more clearly? If anyone has suggestions, I would greatly appreciate it. Thanks!

1

There are 1 best solutions below

3
On

This can be done in Maple by the short code

with(GraphTheory):
M := Matrix(17, 17, (i, j) -> if is(i+j, prime) and i+j <> 2 
then i+j else 0 end if):
G := Graph(M);
KruskalsAlgorithm(G, w, animate);

See one of the frames: enter image description here

The loop at vertex $1$ ($1+1=2$) should be excluded from $G$. See that animation in action here.