Question

Let GG be a complete undirected graph on 4 vertices, having 6 edges with weights being 1, 2, 3, 4, 5, and 6. The maximum possible weight that a minimum weight spanning tree of GG can have is _____.

Official answer and solution
Official answer
7
From
Official GATE 2016 answer key

Solution

Use Kruskal's algorithm to analyze which edge weights can form a cycle to maximize the MST weight.

Let G=K4G = K_4 have 4 vertices {A,B,C,D}\{A, B, C, D\} and 6 edges with weights {1,2,3,4,5,6}\{1, 2, 3, 4, 5, 6\}. Any spanning tree of K4K_4 contains exactly 4−1=34 - 1 = 3 edges.

Trace Kruskal's algorithm on the sorted edges:

  1. The edge with weight 1 is always chosen first (no cycle possible with 1 edge).
  2. The edge with weight 2 is always chosen second (no cycle possible with 2 edges in a simple graph).

To maximize the total weight of the MST, we want Kruskal's algorithm to reject the smaller remaining weights (such as 3) so that heavier edges are forced into the tree.

Can the edge of weight 3 be rejected?
Yes! If edges of weights 1, 2, and 3 form a triangle on vertices {A,B,C}\{A, B, C\} (i.e. w(A,B)=1,w(B,C)=2,w(A,C)=3w(A, B) = 1, w(B, C) = 2, w(A, C) = 3), then when edge 3 is considered, AA and CC are already connected in the same component. Edge 3 forms a cycle and is REJECTED by Kruskal's algorithm.

Now vertices {A,B,C}\{A, B, C\} form a connected component. To form a spanning tree, the 4th vertex DD must be connected to {A,B,C}\{A, B, C\}.
The 3 edges incident on DD must take the remaining weights {4,5,6}\{4, 5, 6\}.
Kruskal will choose the smallest available edge connecting DD to the existing tree, which has weight 4.

The edges in the resulting MST are {1,2,4}\{1, 2, 4\}.

Total MST weight=1+2+4=7\text{Total MST weight} = 1 + 2 + 4 = 7
Final answer

7

Common trap

Trying to reject edge 4 as well, forgetting that connecting the 4th vertex requires choosing the minimum weight among the edges incident on it.

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2016 Computer Science and Information Technology (CS) Session 1
Question
49 of 65, printed as CS Q.39
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.