How do you count spanning trees in a graph?

Answer:
Cayleys formula states that for a complete graph on n vertices, the number of spanning trees is n^(n-2). For a complete bipartite graph we can use the formula p^q-1 q^p-1. for the number of spanning trees. A generalization of this for any graph is Kirchhoff's theorem or Kirchhoff's matrix tree theorem. This theorem looks at the Laplacian matrix of a graph. ( you may need to look up what that is with some examples).

For graphs with a small number of edges and vertices, you can find all the spanning trees and this is often quicker.

There are also algorithms such as depth-first and breadth-first for finding spanning trees.

First answer by Mathdoc. Last edit by Mathdoc. Contributor trust: 424 [recommend contributor recommended]. Question popularity: 2 [recommend question].