Find the Minimum Spanning Tree of a Graph

Revision as of 06:33, 8 January 2016 by Kipkis (Kipkis | contribs) (importing article from wikihow)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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.

Steps

Using Prim's Algorithm

  1. 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.
  2. 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.
  3. Look at all the arcs connecting to your spanning tree and select the arc of least value to add to your spanning tree.
  4. 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

  1. Look at your graph and find the arc with the least weight (smallest value)
  2. 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.
  3. 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.[1][2]
  • A pen/pencil
  • Coloured pencils/pens for highlighting the arcs you have selected (optional)

Related Articles

Sources and Citations

Published by Online Learns