am = {{0, 1, 0, 0, 0, 1}, {1, 0, 1, 0, 0, 0}, {0, 1, 0, 1, 1, 0}, {0,
0, 1, 1, 0, 1}, {0, 0, 1, 1, 0, 1}, {1, 0, 0, 1, 1, 1}};
g0 = UndirectedGraph[SimpleGraph@AdjacencyGraph[am]UndirectedGraph[SimpleGraph @ AdjacencyGraph @ am,
VertexCoordinates -> Reverse@CirclePoints[Reverse @ CirclePoints[{1, Pi}, 6],
VertexLabels -> "Name"]
trees = Select[TreeGraphQ[Graph@#] &] @ Select[VertexCount @ # == 6 &]@
Subsets[EdgeList[g0], {5}];
Length @ trees
32
This matches what we should expect from Kirchhoff's Theorem:
Det[KirchhoffMatrix[g0][[2 ;;, 2 ;;]]]
32
We can also get the resultsame number using IGSpanningTreeCount
from IGraphM
package:
<< IGraphM`
IGSpanningTreeCount[g0]
32
These 32 trees fall into three isomorphic groups:
Length /@ Gather[Graph /@ trees, IsomorphicGraphQ]
{10, 16, 6}
Graph[#, VertexLabels -> Placed["Name", Center], VertexStyle -> White,
GraphLayout -> "LayeredEmbedding",
VertexShapeFunction -> (Disk[#, Offset[7]] &),
AspectRatio -> 1] & /@ trees // Multicolumn[#, 6] &
HighlightGraph[g0, #, GraphHighlightStyle -> "Thick"] & /@ trees //
Multicolumn[#, 6, Appearance -> "Horizontal"] &