TOPICS
Search

Spanning Tree


SpanningTrees

A spanning tree of a graph on n vertices is a subset of n-1 edges that form a tree (Skiena 1990, p. 227). For example, the spanning trees of the cycle graph C_4, diamond graph, and complete graph K_4 are illustrated above.

The number tau(G) of nonidentical spanning trees of a graph G is equal to any cofactor of the degree matrix of G minus the adjacency matrix of G (Skiena 1990, p. 235). This result is known as the matrix tree theorem. A tree contains a unique spanning tree, a cycle graph C_n contains n spanning trees, and a complete graph K_n contains n^(n-2) spanning trees (Trent 1954; Skiena 1990, p. 236).

If e is an edge of a graph G, then

tau(G)=tau(G-e)+tau(G degreese),

where edge contraction of the edge e in G is denoted G degreese (West 2000, Alikhani and Ghanbari 2024).

A count of the spanning trees of a graph can be found using the command NumberOfSpanningTrees [g] in the Wolfram Language package Combinatorica` . For a connected graph, it is also given by

tau=T(1,1),

where T(x,y) is the Tutte polynomial.

Kruskal's algorithm can be used to find a maximum or minimum spanning tree of graph.

The following table summarizes the numbers of spanning trees for various named classes of graphs.

class OEIS spanning tree counts
Andrásfai graph A193126 1, 5, 392, 130691, 116268789, 217138318913, ...
antiprism graph A193127 X, X, 384, 3528, 30250, 248832, 1989806, ...
Apollonian network A193128 16, 1445, 487350000, 6820689973308563232421875, ...
barbell graph A193129 X, X, 9, 256, 15625, 1679616, 282475249, ...
book graph S_(n+1) square P_n A006234 X, X, 54, 189, 648, 2187, 7290, 24057, ...
cocktail party graph K_(n×2) A193130 0, 4, 384, 82944, 32768000, 20736000000, ...
complete graph K_n A000272 1, 1, 3, 16, 125, 1296, 16807, 262144, ...
complete bipartite graph K_(n,n) A068087 1, 4, 81, 4096, 390625, 60466176, 13841287201, ...
complete tripartite graph K_(n,n,n) A193131 3, 384, 419904, 1610612736, 15000000000000, ...
crossed prism graph A193132 X, X, X, 384, X, 9216, X, 196608, X, 3932160, ...
crown graph A193133 X, X, 6, 384, 40500, 6635520, 1575656250, ...
cube-connected cycle graph A000000 X, X, 32400000, 5068660643117137920000, ...
cycle graph C_n A000027 X, X, 3, 4, 5, 6, 7, 8, 9, 10, ...
fan graph A000000 X, 8, 216, 13056, 1409375, ...
fiveleaper graph A000000 X, X, X, X, 0, 0, 0, 331898989520947048842445518274560, ...
folded cube graph A193134 X, 1, 16, 4096, 2147483648, 14167099448608935641088, ...
gear graph A129743 X, X, 50, 192, 722, 2700, 10082, 37632, 140450, 524172
grid graph P_n square P_n A007341 1, 4, 192, 100352, 557568000, 32565539635200, ...
grid graph P_n square P_n square P_n A071763 1, 384, 8193540096000, ...
halved cube graph A193135 1, 1, 16, 82944, 126806761930752, ...
Hanoi graph A193136 3, 135, 20503125, 119709242282867431640625, ...
helm graph A004146 X, X, 16, 45, 121, 320, 841, 2205, 5776, 15125, ...
hypercube graph Q_n A006237 1, 4, 384, 42467328, 20776019874734407680, ...
king graph A000000 X, 16, 17745, 1064918960, 3271331573452800, ...
knight graph A000000 X, 0, 0, 144000, 136323072000, 5398085382092881920, ...
ladder graph P_2 square P_n A001353 1, 4, 15, 56, 209, 780, 2911, 10864, 40545, 151316, ...
Möbius ladder M_n A020871 X, X, 81, 392, 1815, 8112, 35301, 150544, 632043, ...
Mycielski graph A193148 1, 1, 5, 38642, 3568248132106250, ...
odd graph A193149 1, 3, 2000, 336140000000000000, ...
pan graph A000027 X, X, 3, 4, 5, 6, 7, 8, 9, 10, ...
path graph P_n A000012 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
permutation star graph A193150 1, 1, 6, 162000000, ...
prism graph A006235 X, X, 75, 384, 1805, 8100, 35287, 150528, ...
queen graph A000000 X, 16, 541205, 54711160897536, ...
rook graph A193137 X, 4, 11664, 34359738368, 156250000000000000000, ...
stacked book graph A000000 X, X, 56, 1, 35733190625,...
star graph S_n A000012 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
sun graph A193152 X, X, 54, 600, 9610, 202800, 5329646, 167968080, ...
sunlet graph C_n circledot K_1 A000027 X, X, 3, 4, 5, 6, 7, 8, 9, 10
tetrahedral Johnson graph A000000 X, X, X, X, X, 96745881600000000, ...
triangular graph A193154 X, 1, 3, 384, 2048000, 518400000000, ...
web graph A006235 X, X, 75, 384, 1805, 8100, 35287, 150528, ...
wheel graph W_n A004146 X, X, X, 16, 45, 121, 320, 841, 2205, ...

Closed forms for the numbers of spanning trees for various named classes of graphs are given in the table below, where phi is the golden ratio, L_n is a Lucas number, U_n(x) is a Chebyshev polynomial of the second kind, C_n^((m))(x) is a Gegenbauer polynomial, and L_n is a Lucas number. tau(W_n) was considered by Koshy (2001) and Alikhani and Ghanbari (2024).

class closed form
antiprism graph 2/5n(phi^(4n)+phi^(-4n)-2)
book graph S_(n+1) square P_n 3^(n-1)(n+3)
cocktail party graph K_(n×2) 4^(n-1)(n-1)^nn^(n-2)
complete graph K_n n^((n-2))
complete bipartite graph K_(n,n) n^(2n-2)
complete tripartite graph K_(n,n,n) 3·8^(n-1)n^(3n-2)
crossed prism graph 3n·2^(2n-3)
helm graph L_(2n)-2
ladder graph P_2 square P_n ((2+sqrt(3))^n-(2-sqrt(3))^n)/(2sqrt(3))
=(sinh(ncosh^(-1)2))/(sqrt(3))
=U_(n+1)(2)
=C_(n-1)^((1))(2)
Möbius ladder M_n 1/2n[2+(2+sqrt(3))^n+(2-sqrt(3))^n]
path graph P_n 1
prism graph Y_n 1/2n[(2-sqrt(3))^n+(2+sqrt(3))^n-2]
star graph S_n 1
sunlet graph C_n circledot K_1 n
wheel graph W_n L_(2(n-1))-2

See also

Detour Matrix, Dijkstra's Algorithm, Kruskal's Algorithm, Matrix Tree Theorem, Maximum Spanning Tree, Minimum Spanning Tree, Shortest Path Problem, Taxicab Metric, Tree

Explore with Wolfram|Alpha

References

Alikhani, S. and Ghanbari, N. "Golden Ratio in Graph Theory: A Survey." 9 Jul 2024. https://arxiv.org/abs/2407.15860.Colbourn, C. J.; Day, R. P. J.; and Nel, L. D. "Unranking and Ranking Spanning Trees of a Graph." J. Algorithms 10, 271-286, 1989.Eppstein, D. "Spanning Trees and Spanners." Ch. 9 in Handbook of Computational Geometry (Ed. J.-R. Sack and J. Urrutia). Amsterdam, Netherlands: North-Holland, pp. 425-461, 2000.Godsil, C. and Royle, G. Algebraic Graph Theory. New York: Springer-Verlag, 2001.Koshy, T. Fibonacci and Lucas Numbers With Applications. New York: Wiley-Interscience, 2001.Nikolić, S.; Trinajstić, N.; and Mihalić, A. "The Detour Matrix and the Detour Index." Ch. 6 in Topological Indices and Related Descriptors in QSAR and QSPR (Ed. J. Devillers A. T. and Balaban). Amsterdam, Netherlands: Gordon and Breach, pp. 285-286, 2000.Skiena, S. Implementing Discrete Mathematics: Combinatorics and Graph Theory with Mathematica. Reading, MA: Addison-Wesley, pp. 224-227, 1990.Sloane, N. J. A. Sequences A000012/M0003, A000027/M0472, A000272/M3072, A001353/M3499, A0041463867, A006234/M3496, A006235/M4849, A006237/M3725, A007341, A020871, A068087, A071763, A129743, A193126, A193127, A193128, A193129, A193130, A193131, A193132, A193133, A193134, A193135, A193136, A193137, A193148, A193149, A193150, A193151, A193152, A193153, A193154 in "The On-Line Encyclopedia of Integer Sequences."Trent, H. "A Note on the Enumeration and Listing of All Possible Trees in a Connected Linear Graph." Proc. Nat. Acad. Sci. U.S.A. 40, 1004-1007, 1954.West, D. B. Introduction to Graph Theory, 2nd ed. Englewood Cliffs, NJ: Prentice-Hall, 2000.Zheng

Referenced on Wolfram|Alpha

Spanning Tree

Cite this as:

Weisstein, Eric W. "Spanning Tree." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/SpanningTree.html

Subject classifications

AltStyle によって変換されたページ (->オリジナル) /