Skip to content
Official PYQ · 2011

GATE CS 2011 Q54 — Minimum Spanning Trees

Explain with AI

An undirected graph G(V,E)G(V,E) contains n (n>2)n \: (n>2) nodes named v1,v2,…,vnv_1,v_2, \dots, v_n. Two nodes vi,vjv_i, v_j  are connected if and only if 0<∣i−j∣≤20 < \mid i-j\mid \leq 2. Each edge (vi,vj)(v_i,v_j) is assigned a weight i+ji+j. A sample graph with n=4n=4 is shown below.

What will be the cost of the minimum spanning tree (MST) of such a graph with nn nodes?

Choose one option
View worked solution

Answer: B

To find the cost of the Minimum Spanning Tree (MST) for a graph with nn nodes, we can analyze the structure of the MST using Kruskal's algorithm.

For any node viv_i, it is connected to vjv_j if and only if 0<∣i−j∣≤20 < |i-j| \le 2, with edge weight i+ji+j. Sorting the edges by weight, the lowest-weight edges that do not form a cycle are selected:

  • The edge (v1,v2)(v_1, v_2) with weight 1+2=31 + 2 = 3.
  • For each ii from 33 to nn, the edge (vi−2,vi)(v_{i-2}, v_i) with weight (i−2)+i=2i−2(i-2) + i = 2i - 2.

These n−1n-1 edges connect all nodes without cycles (the odd-indexed nodes form one path, the even-indexed nodes form another, and they are joined by the edge (v1,v2)(v_1, v_2)).

The total cost of this MST is:

Cost=3+∑i=3n(2i−2)\text{Cost} = 3 + \sum_{i=3}^{n} (2i - 2)

Letting j=i−1j = i-1, the summation becomes:

Cost=3+2∑j=2n−1j=3+2[n(n−1)2−1]=n2−n+1\text{Cost} = 3 + 2 \sum_{j=2}^{n-1} j = 3 + 2 \left[ \frac{n(n-1)}{2} - 1 \right] = n^2 - n + 1

Alternative Method (Substitution):

For n=4n = 4:

  • The edges are (v1,v2)(v_1, v_2) [wt 3], (v1,v3)(v_1, v_3) [wt 4], (v2,v3)(v_2, v_3) [wt 5], (v2,v4)(v_2, v_4) [wt 6], and (v3,v4)(v_3, v_4) [wt 7].
  • The MST selects edges (v1,v2)(v_1, v_2), (v1,v3)(v_1, v_3), and (v2,v4)(v_2, v_4) with total cost 3+4+6=133 + 4 + 6 = 13.

Substituting n=4n = 4 into the options:

  • Option A: 112(11(16)−5(4))=13\frac{1}{12}(11(16) - 5(4)) = 13
  • Option B: 42−4+1=134^2 - 4 + 1 = 13
  • Option C: 6(4)−11=136(4) - 11 = 13

For n=5n = 5, the MST selects (v1,v2)(v_1, v_2), (v1,v3)(v_1, v_3), (v2,v4)(v_2, v_4), and (v3,v5)(v_3, v_5) with total cost 3+4+6+8=213 + 4 + 6 + 8 = 21. Substituting n=5n = 5 into the remaining options:

  • Option B: 52−5+1=215^2 - 5 + 1 = 21 (Correct)
  • Option A: 25012≈20.83\frac{250}{12} \approx 20.83
  • Option C: 6(5)−11=196(5) - 11 = 19

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Minimum Spanning Trees questions