# How to use NumberOfSpanningTrees ?

GROUPS:
 Shenghui Yang 2 Votes Hey there, The documentation page of this function is quite limited. I followed the instruction but following code does not output useful information:Needs["Combinatorica"]NumberOfSpanningTrees[HypercubeGraph[3]]I want to draw the spanning true of a hypercube, do you know any internal functions other than this one?  Thanks
 William Rummler 2 Votes Hey Shenghui,HypercubeGraph returns a SystemGraph, not a CombinatoricaGraph. Try this:Block[{$ContextPath}, Needs@"Combinatorica"]Needs@"GraphUtilities"CombinatoricaNumberOfSpanningTrees@ ToCombinatoricaGraph@HypercubeGraph@3(* Out: 384 *)--William Answer 2 years ago  Shenghui Yang 2 Votes Definitely two thumbs up to the workaround !My secound question would be what this 384 means? I think I can only draw several (not full set but definitely not more than 10) spanning trees for a 3-cube graph, per my understanding, it is just a set of edges of 3-D cube, right? Answer 2 years ago  William Rummler 1 Vote The output of 384 refers to the number of spanning trees in the 3-hypercube graph. A spanning tree is basically a connected acyclic subset of edges in the graph such that each vertex in the graph is incident on at least one edge in the subset. (Kirchoff's Theorem gives a very nice and efficient algorithm for computing the number of spanning trees, and Combinatorica.m uses that approach.)You can use Combinatorica's MinimumSpanningTree to get at least one MST. To get other ones, you could delete an edge you would like to avoid and put the edge-deleted graph through MinimumSpanningTree again. That feels kind of hacky, but it is easy enough to do for only ~10 MSTs if you just need them quickly. Block[{$ContextPath}, Quiet@Needs@"Combinatorica"]  Needs@"GraphUtilities"  g = HypercubeGraph@3;  cg = CombinatoricaMakeUndirected@ToCombinatoricaGraph@g;  mst = CombinatoricaMinimumSpanningTree@cg;CombinatoricaShowGraph@mstAdjacencyGraph@CombinatoricaToAdjacencyMatrix@mst