Consider the graph shown below: Use Kruskal’s algorithm to find the minimum…

2018

Consider the graph shown below:

Use Kruskal’s algorithm to find the minimum spanning tree of the graph. The weight of this minimum spanning  tree is

  1. A.

    17

  2. B.

    14

  3. C.

    16

  4. D.

    13

Attempted by 297 students.

Show answer & explanation

Correct answer: C

Key idea: Use Kruskal's algorithm: sort all edges by weight and add the smallest edges one by one, skipping any edge that would form a cycle, until all vertices are connected.

Step-by-step (using position names for outer vertices: top, top-right, right, lower-right, bottom, lower-left, left, top-left, and center):

  • Pick all edges of weight 1 that do not form a cycle: the spoke connecting the top-right outer vertex to the center (weight 1), the perimeter edge between the top-right and right outer vertices (weight 1), the perimeter edge between the lower-right and bottom outer vertices (weight 1), and the perimeter edge between the top-left and left outer vertices (weight 1).

  • Next add the smallest remaining edges of weight 2 that connect new vertices without creating cycles: the perimeter edge between the top and top-left outer vertices (weight 2) and the perimeter edge between the right and lower-right outer vertices (weight 2).

  • Add the next smallest edge of weight 3 that connects remaining components: the spoke from the top outer vertex to the center (weight 3).

  • Finally, add the remaining necessary edge of weight 5 (the spoke from the lower-right outer vertex to the center) to connect the final component without forming a cycle.

The chosen edge weights are: 1, 1, 1, 1, 2, 2, 3, 5.

Total weight: 16

Comments: This set of edges connects all nine vertices (the eight outer vertices plus the center) without cycles and uses the smallest available edges in increasing order. Any attempt to reduce the total further would either disconnect a vertex or require replacing an included edge by a heavier one, so 16 is the minimum possible total.

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

Explore the full course: Coding For Placement