Find the Minimum Spanning Tree of a Graph
Need to find a minimum spanning tree? Look no further, here are a few algorithms that should be able to help you complete your task.
Contents
Steps
Using Prim's Algorithm
- Pick a starting node (the things you are connecting) this can be any node on your graph as a minimum spanning tree will join all of the nodes together.
- Look at the arcs which connect to this point and choose the one with the lowest value. You will now have two nodes joined together, this is the start of your spanning tree.
- Look at all the arcs connecting to your spanning tree and select the arc of least value to add to your spanning tree.
- Repeat the above step until all of your nodes have been included in the minimum spanning tree. If the arc of least value is between two nodes already in your minimum spanning tree ignore it as this arc is unnecessary and you would no longer have a minimum spanning tree.
Using Kruskal's Algorithm
- Look at your graph and find the arc with the least weight (smallest value)
- From the arcs remaining pick the arc with least weight which does not create a cycle (a closed loop and therefore not a spanning tree) with your other arcs.
- Count the nodes and minus 1. This is how many arcs you should use. Repeat step 2 until you have selected this number of arcs.
Thing's You'll Need
- A Graph (you may have to draw one if you are using this for a project. If it is for schoolwork you will most likely already have the graph)
- There are free graphs that can be found on line as well.
- A pen/pencil
- Coloured pencils/pens for highlighting the arcs you have selected (optional)
Related Articles
- Graph Points on the Coordinate Plane
- Graph Polar Equations
- Graph Inequalities
- Determine Whether Two Variables Are Directly Proportional
Sources and Citations
Published by Online Learns