Finding the minimum spanning tree of a complete graph using Prim's Algorithm

Pretty much what the title says, I'm using Prim's Algorithm to find the shortest tree which touches each node. It's pretty slow, with a complexity of O(n^2) where n is the number of vertices, so it will take forever if you make a load of vertices.

Click to add a vertex or press "Random!" to add 20 random vertices.