Question
Let 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 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 have 4 vertices and 6 edges with weights . Any spanning tree of contains exactly edges.
Trace Kruskal's algorithm on the sorted edges:
- The edge with weight 1 is always chosen first (no cycle possible with 1 edge).
- 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 (i.e. ), then when edge 3 is considered, and are already connected in the same component. Edge 3 forms a cycle and is REJECTED by Kruskal's algorithm.
Now vertices form a connected component. To form a spanning tree, the 4th vertex must be connected to .
The 3 edges incident on must take the remaining weights .
Kruskal will choose the smallest available edge connecting to the existing tree, which has weight 4.
The edges in the resulting MST are .
7
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.