GATE Computer ScienceVery hardGATE CS (PYQ pattern)

A weighted undirected graph has vertices A–F and edges AB 1, BC 1, CA 1, CD 2, DE 2, EC 2, EF 3, FD 3, AF 7. How many distinct minimum spanning trees does it have?

  1. A. 18
  2. B. 9
  3. C. 12
  4. D. 27

Correct answer: A. 18

The MST weight is 9. Triangle ABC (all weights 1) contributes any 2 of its 3 edges (3 ways), triangle CDE (all weights 2) any 2 of 3 (3 ways), and F attaches by exactly one of the two weight-3 edges (2 ways): 3 × 3 × 2 = 18. The edge AF 7 never enters.

More Algorithms questions

Exams that ask this topic