Prim's MST: Does the start node matter?

Nick Heiner picture Nick Heiner · Nov 24, 2009 · Viewed 7k times · Source

I intuitively feel that if one is using Prim's algorithm to find a graph's minimum spanning tree, it doesn't matter which root node is picked - the resultant MST will have the same weight regardless. Is this correct?

Answer

Mark Byers picture Mark Byers · Nov 24, 2009

That is correct. Choosing a different starting node could give you a different spanning tree, but it will always have the same weight: the minimal possible.