IAE Academy

ISRO CS 2023 Q.1: solution and answer

ISRO 2023 · CSQ.1 · 1 mark · MCQ

Find the minimum spanning distance and the corresponding number of edges for the following graph

ISRO CS 2023 question 1: Undirected weighted graph on vertices A, B, C, D, E.Tap to open full size
Figure from the ISRO CS 2023 paper. It is part of the question.
Figure description

Undirected weighted graph on vertices A, B, C, D, E. Drawn as a house: A is the apex on top; B is the left roof corner and C the right roof corner; D is the bottom-left and E the bottom-right corner. Edges: A-B weight 1, A-C weight 7, B-C weight 5 (horizontal line under the roof), B-D weight 4 (left vertical side), B-E weight 3 (diagonal from B down to E), C-E weight 6 (right vertical side), D-E weight 2 (bottom side). Seven edges in total.

  1. (A)

    10, 3

  2. (B)

    11, 4

  3. (C)

    15, 4

  4. (D)

    28, 7

Answer and solution

ANSWER

The minimum spanning tree has weight 11 and 4 edges, option (b).

Official answer: BSource: ISRO's revised and final answer key of 16 February 2024

  1. The edges are , , , , , , . There are 5 vertices, so every spanning tree has edges.

  2. Kruskal's rule: sort the edges by weight and add each one unless it closes a cycle.

  3. Add , which joins A and B. Add , which joins D and E. Add , which joins the components and into .

  4. Skip : B and D are already connected through E, so adding it would close the cycle --.

  5. Add : C is the only vertex not yet in the tree, so this edge cannot form a cycle. The tree now has 4 edges, so stop.

  6. Total weight with edges, which is option (b). Option (a) has only 3 edges, too few to span 5 vertices. Options (c) and (d) are heavier: 28 is the sum of all 7 edges, and 15 with 4 edges cannot be minimal because a tree of weight 11 exists.

KEY IDEA

A minimum spanning tree of a connected graph with vertices always has edges. Kruskal's algorithm builds one by taking the lightest edges that do not form a cycle.

WATCH OUT FOR

Adding after and closes a cycle. Another slip is quoting the sum of all edges (28 with 7 edges) as the answer.

From the ISRO CS 2023 paper. Every question of this paper · The full paper (PDF, ISRO) · All 2 ISRO Graph algorithms questions, with notes