Exercise: Prim’s Algorithm
Test your understanding of Prim’s algorithm.
We'll cover the following
The task at hand
Given the graph in the playground below, select a vertex that you would like to serve as the root vertex. Now, grab a paper and a pen and figure out the minimum spanning tree found by Prim’s algorithm from the highlighted source vertex to all other vertices.
You may verify your solution by clicking the “Run Prim’s Algorithm” button.
Note:
- You can also experiment on a different graph using these
instructions. instructions - If you choose to add a new edge, its weight will be generated randomly.
- If the automatically generated labels overlap with vertices or edges, you may view them more clearly by dragging the vertices of the given graph (after selecting the “Drag vertices” checkbox).
Get hands-on with 1400+ tech skills courses.