The weight of minimum spanning tree in graph đș, calculated using Kruskal’s


2019

The weight of minimum spanning tree in graph đș, calculated using Kruskal’s algorithm is:

  1. A.

    14

  2. B.

    15

  3. C.

    17

  4. D.

    18

Attempted by 544 students.

Show answer & explanation

Correct answer: B

Answer: 15

Apply Kruskal’s algorithm. List the edges by increasing weight and pick them if they do not form a cycle.

Sorted edge weights (with their locations): 2 (top apex–top-left), 3 (bottom-left–bottom-right), 4 (diagonal top-left–bottom-right), 5 (left vertical), 6 (top horizontal), 7 (right vertical), 8 (slanted top-right)

  1. Pick the smallest edge: weight 2 (connects top apex and top-left).

  2. Next pick weight 3 (connects bottom-left and bottom-right).

  3. Next pick weight 4 (the diagonal between top-left and bottom-right). This merges the two components without creating a cycle.

  4. Check the next smallest edge (weight 5). Adding the weight-5 edge would create a cycle, so skip it.

  5. Next valid edge to connect any remaining vertex is weight 6 (top horizontal). Pick it; now all vertices are connected.

Selected edges and their weights: 2, 3, 4, 6

Total weight = 2 + 3 + 4 + 6 = 15

Therefore the weight of the minimum spanning tree is 15.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Coding For Placement