Data Structures & AlgorithmsVery hardGATE CS · ICPC regional
Count the spanning trees of the simple graph on vertices 0 to 5 with edges 0-1, 0-4, 1-2, 1-3, 1-4, 1-5, 2-3, 3-5, 4-5. How many spanning trees does it have?
- A. 4
- B. 126
- C. 1296
- D. 55
Correct answer: D. 55
A spanning tree is a set of n − 1 edges that connects every vertex without a cycle. Choosing any n − 1 edges without checking for cycles or connectivity overcounts, and the labelled-tree formula n^(n−2) counts trees of K_n, not of this graph.
Practise more Trees, Graphs, Recursion and Dynamic Programming questionsTrees, Graphs, Recursion and Dynamic Programming: notes and key points
More Trees, Graphs, Recursion and Dynamic Programming questions
- Count the spanning trees of the simple graph on vertices 0 to 4 with edges 0-4, 1-2, 1-3, 2-4, 3-4. How many spanning trees does it have?
- Count the spanning trees of the simple graph on vertices 0 to 3 with edges 0-1, 1-2, 1-3, 2-3. How many spanning trees does it have?
- Count the spanning trees of the simple graph on vertices 0 to 5 with edges 0-1, 0-2, 1-3, 1-4, 1-5, 2-3, 2-5, 3-4. How many spanning trees…
- Count the spanning trees of the simple graph on vertices 0 to 4 with edges 0-1, 0-2, 0-3, 1-3, 2-4, 3-4. How many spanning trees does it…
- Count the spanning trees of the simple graph on vertices 0 to 5 with edges 0-1, 0-2, 0-4, 0-5, 1-3, 1-4, 1-5, 2-5, 3-4. How many spanning…
- Count the spanning trees of the simple graph on vertices 0 to 4 with edges 0-1, 0-2, 0-3, 1-2, 1-4, 2-3, 3-4. How many spanning trees does…