GATE CS 2011 · Graph Traversals (BFS & DFS)

MCQ · 2 marks · Problem PROG-GRPH-0086

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\).For \(n=10\), the length of the path from \(v_5\) to \(v_6\) in the minimum spanning tree (MST) of \(G\) is
  1. A
    11
  2. B
    25
  3. C
    31
  4. D
    41

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.So the MST is the path \(\cdots v_7 - v_5 - v_3 - v_1 - v_2 - v_4 - v_6 \cdots\), and the path from \(v_5\) to \(v_6\) is \(v_5-v_3-v_1-v_2-v_4-v_6\):\[8+4+3+6+10=31\]Answer: C

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