Consider the following undirected graph with edge weights as shown: The number of minimum-weight spanning trees of the graph is …
Topic-wise GATE CS PYQs with verified steps
GATE CSE 2021 Set 1 · Q17
Time

Your answerNumerical answer
Solution
Official answer: 3
Minimum Spanning TreesThe graph contains vertices arranged in a grid. A spanning tree must contain edges.
Edges of weight :
There are edges with weight .
These edges do not contain any cycle and connect the vertices into disjoint connected components:
Component 1: (the top row)
Component 2: (the middle and bottom rows)
By Kruskal's algorithm, all edges of weight must be included in any minimum spanning tree.
Edges of weight :
To connect the two components into a single spanning tree, exactly edge of weight that crosses between Component 1 and Component 2 must be chosen.
The available crossing edges between the top row and middle row are the three vertical edges: , , and .
Any other edge of weight connects vertices within Component 2 and would create a cycle.
Therefore, there are 3 possible choices to complete the MST, resulting in distinct minimum-weight spanning trees of total weight:
Try the question first, then check your work.
Examiner trap
Count how many edges have weight and check if they form any cycles. Then determine how many edges of weight can connect the remaining components.
This Minimum Spanning Trees previous year question is Q17 of the GATE CSE 2021 Set 1 paper. Find more GATE CSE PYQs on Minimum Spanning Trees in Algorithms, or browse all GATE CSE PYQs.
Free diagnostic
Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Minimum Spanning Trees PYQs now with no account.
An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.
Minimum Spanning Trees has 13 GATE CSE PYQs across 9 papers from 2011 to 2026. This is the only 1-mark NAT question among them, and it is the only one in GATE CSE 2021 Set 1.
How GATE tests Minimum Spanning TreesIndependent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.