Data Structures & AlgorithmsVery hardGATE CS

The weighted undirected graph A–B (1), A–C (3), A–D (5), B–D (3), B–E (6), C–D (3), D–E (6) has repeated weights. How many different minimum spanning trees does it have, and what is their weight?

  1. A. 6 MSTs of weight 13
  2. B. 1 MST of weight 13
  3. C. 7 MSTs of weight 13
  4. D. 21 MSTs of weight 13

Correct answer: A. 6 MSTs of weight 13

Every MST takes the same multiset of weights; process weight classes in increasing order and count how many ways each class can join the components left by lighter edges. Enumerating all 21 spanning trees confirms 6 reach the minimum 13.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic