GATE Computer ScienceVery hardGATE CS (PYQ pattern)

How many spanning trees of the complete graph K₅ (vertices 1–5) contain neither the edge 1-2 nor the edge 1-3?

  1. A. 25
  2. B. 45
  3. C. 75
  4. D. 40

Correct answer: D. 40

K₅ has 5³ = 125 spanning trees; each edge lies in 125·4/10 = 50 of them. Trees containing both 1-2 and 1-3 (a path 2-1-3): 5^(3−2)·3·1·1 = 15. Inclusion–exclusion: 125 − 50 − 50 + 15 = 40. Forgetting the add-back gives 25; 45 is the count for two disjoint edges such as 1-2 and 3-4.

More Algorithms questions

Exams that ask this topic