GATE CS 2011 · Shortest Path Algorithms

MCQ · 2 marks · Problem PROG-GRPH-0087

An undirected graph \(G(V, E)\) contains \(n\) (\(n>2\)) nodes named \(v_1, v_2, \ldots, v_n\). Two nodes \(v_i, v_j\) are connected if and only if \(0<|i-j|\le 2\). Each edge \((v_i, v_j)\) is assigned a weight \(i+j\). For example, for \(n=4\) the edges are \((v_1,v_2)\), \((v_1,v_3)\), \((v_2,v_3)\), \((v_2,v_4)\) and \((v_3,v_4)\), with weights \(3, 4, 5, 6\) and \(7\).What will be the cost of the minimum spanning tree (MST) of such a graph with \(n\) nodes?
  1. A
    \(\frac{1}{12}(11n^{2}-5n)\)
  2. B
    \(n^{2}-n+1\)
  3. C
    6n-11
  4. D
    2n+1

Solve it on GATE DA practice →More Graph Theory & Algorithms problems

Show the worked solution\[\boxed{\text{MST}=\{(v_1,v_2)\}\cup\{(v_i,v_{i+2}) : 1\le i\le n-2\}}\]Kruskal takes \((v_1,v_2)\) (weight \(3\)) and every edge \((v_i,v_{i+2})\) (weight \(2i+2\)); each edge \((v_{i+1},v_{i+2})\) (weight \(2i+3\)) would close a cycle.\[\text{Cost}=3+\sum_{i=1}^{n-2}(2i+2)=3+(n-2)(n-1)+2(n-2)=n^{2}-n+1\]Answer: B

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com