(Latest Revision: Apr 01, 2019)

MST Problems


First MST Problem:

Suppose G=(V,E) is a connected undirected graph whose vertex set V is equal to {1,2,3,4,5,6,7}. Suppose that the edges of G are as follows, sorted by increasing weight.
edge  weight

{3, 5}   1
{1, 2}   2
{3, 7}   2
{2, 3}   2
{2, 7}   3
{3, 4}   4
{1, 4}   5
{4, 5}   5
{1, 6}   6
{3, 6}   7
{6, 7}   8
Use Kruskal's algorithm to determine the edges in a min cost spanning tree. In your answer, list the edges in the min cost spanning tree, and their weights, in the order that Kruskal's algorithm would find them.

Solution
edge  weight
                               sets {1}  {2}  {3}  {4}  {5}  {6}  {7} 
{3, 5}   1  accept #1          sets {1}  {2}  {3,5}  {4}  {6}  {7} 
{1, 2}   2  accept #2          sets {1,2}  {3,5}  {4}  {6}  {7} 
{3, 7}   2  accept #3          sets {1,2}  {3,5,7}  {4}  {6}
{2, 3}   2  accept #4          sets {1,2,3,5,7}  {4}  {6}
{2, 7}   3  reject             sets {1,2,3,5,7}  {4}  {6}
{3, 4}   4  accept #5          sets {1,2,3,4,5,7}  {6}
{1, 4}   5  reject             sets {1,2,3,4,5,7}  {6}
{4, 5}   5  reject             sets {1,2,3,4,5,7}  {6}
{1, 6}   6  accept #6          sets {1,2,3,4,5,7,6}  
                       (Now we are finished, because we have one set and 6 edges.
                        The edges and weights are listed above as "accept" #1-6)
{3, 6}   7
{6, 7}   8
Second MST Problem:

Make a drawing of the graph, showing the nodes, edges, and weights. Assuming that node #1 is the start node, list the edges of a min cost spanning tree in the order that they would be found by Prim's algorithm.

Solution
It's pretty easy to draw the graph with 1,2,3,4 the corners of a square, 
and the others inside the square, 5 close to 4, 7 close to 2, and 6 close to 1. 

It's also pretty easy to use the list of edges ordered by weight above 
to find the edges chosen by Prim's algorithm, in order.
Because 1 is the start node, the first edge chosen by Prim's algorithm
will be the first in the list that contains 1, which is {1,2} 2.
The next edge is the one of least cost that leaves the set {1,2}, which is {2,3} 2.
Next is the edge of least cost that leaves the set {1,2,3}, which is {3,5} 1.
Next is the edge of least cost that leaves the set {1,2,3,5}, which is {3,7} 2.
Next is the edge of least cost that leaves the set {1,2,3,5,7}, which is {3,4} 4.
Next is the edge of least cost that leaves the set {1,2,3,4,5,7}, which is {1,6} 6.
                       (Now we are finished, because we have reached all nodes.)