Data Structures & AlgorithmsHardGATE CS · Advanced

A graph has the vertices A–F and the edges A–B, A–C, B–C, B–D, C–D, C–E, D–E, D–F, E–F, A–F. How many distinct spanning trees does it have?

  1. A. 130
  2. B. 252
  3. C. 136
  4. D. 125

Correct answer: A. 130

By the Matrix-Tree theorem the count equals any cofactor of the Laplacian matrix, here 130 (checked by enumerating all 5-edge subsets). Choosing any 5 of 10 edges (252) overcounts because it includes cyclic sets.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic