COUNTING AND ENUMERATING SPANNING TREES IN (di-) GRAPHS Xuerong Yong Version of Feb 5, 9 pm, 06: New York Time 1
1 Introduction A directed graph (digraph) D is a pair (V, E): V is the vertex set of D, E the edge set of D. An edge e = (u, v), u, v V. (u, v) = (v, u)? An undirected graph (graph) G is a pair (V, E), where the edge set is of unordered pair of verties. (u, v) = (v, u) Self-loop, Path and Cycle, Degree of a Vertex u, Connected Graph, Tree Example: 2
A spanning tree in a graph G is a tree having same vertex set as G. A spanning tree in a digraph D is a rooted tree with the same vertex set as D: there is a vertex specified as the root, and from the root there is a path to any of verties of D and no cycle. Multiple edges and self-loops are permitted in any (di-)graph. 3
Figure 1: G has 3 spanning trees; D has 4 spanning trees rooted at vertex 1. Two Examples: A graph G and all its spanning trees A digraph D and all its (oriented) spanning trees rooted at vertex 1. The Main Problem: Given a (di-)graph, how many spanning trees does it have? 4
The number of spanning trees paid much attention. Long history, Representatives Matrix Tree Theorem (Kirchhoff, 1847) Kelman (1965, 1974) Boesch (1982, 1991) Stanley (1996, 1999) Knuth (1997) Yamaguchi (2004), Lyons (2005) Applications Analyze the reliability of networks; Design electrical circuits; Analyze energy of masers. 5
OUTLINE Introduction Counting the number of spanning trees in a (di-) graphs Graphs with the maximum number of spanning trees Algorithms for enumerating spanning trees Possible research trends 6
Figure 2: Graph G and its reduced graphs G 1 and G 2. 2 Counting the numbers of spanning trees in (di-)graphs Basic combinatorial method Let T (G) be the number of spanning trees in G. Let e = (u, v) be any edge in G. Define G 1 = G with e deleted; G 2 = G with u and v contracted together. Then T (G) = T (G 1 ) + T (G 2 ). So what? 7
Algebraically We need some definitions. Given G with vertex set {v 1, v 2,, v n }. The adjacency matrix A of G is a n n matrix whose (i, j)-entry is a ij where a ij is the number of edges between v i and v j. For matrix A = (a ij ) n n, the cofactor of the (i, j)-entry is ( 1) i+j det A ij where A ij is a (n 1) (n 1) matrix derived from A by deleting i-th row and j-th column. Define a diagonal matrix B = diag(d 1, d 2,, d n ) where d i is the degree of v i. 8
Matrix T ree T heorem a very basic theorem (Kirchhoff, 1847) Let H = B A. Then T (G) is equal to any cofactor of H. H is usually called Kirchhoff matrix, sometimes, Laplacian matrix or Lucacian matrix of G. Its proof follows from the basic combinatorial idea, the multilinearity of the determinants and induction on the numbers of edges and vertices in the graph. There is a similar result for digraph. 9
Figure 3: Example graph. The Kirchhoff matrix H = B A of G is H = 4 1 1 1 0 1 1 3 0 0 1 1 1 0 3 1 1 0 1 0 1 3 1 0 0 1 1 1 4 1 1 1 0 0 1 3. So T (G) = ( 1) 1+1 3 0 0 1 1 0 3 1 1 0 0 1 3 1 0 1 1 1 4 1 1 0 0 1 3 = 128. 10
Kelmans and Chelnokov s method (1974): The eigenvalues of G are the eigenvalues of its adjacency matrix. For G with n vertices, let H be the Kirchhoff matrix of G and µ 1 µ 2 µ n (= 0) be the eigenvalues of H. Then T (G) = 1 n n 1 j=1 µ j. Similar formulas hold for digraphs. 11
Cont d Sachs s method (1962): If G is a regular graph of degree r, then T (G) = 1 n n 1 j=1 (r λ j ), where λ 1 λ 2 λ n = r are the eigenvalues of G. Example: Petersen graph is a regular graph of degree 3. (1) Its eigenvalues are: 3, 1, 1, 1, 1, 1, 2, 2, 2, 2. (2) Eigenvalues of its Kirchhoff matrix: 0, 2, 2, 2, 2, 2, 5, 5, 5, 5. Number of its spanning trees: 2 5 5 4 = 20000. (van Lint and Wilson, 1992) 12
Figure 4: The Petersen graph. Why Still Working On? Even though there are known methods for counting the number, further research is still necessary. Generally, the methods are not feasible for counting the number of spanning trees, especially for large graphs. For comparing the numbers of spanning trees in different classes of graphs, exact formulas are needed. In applications, many graphs are special. And for these graphs it is possible to derive exact recurrence formulas for the number of spanning trees. Recurrence formulas usually give the exact values in computation! 13
Known Results: Cayley s tree formula for complete graph K n : T (K n ) = n n 2. There are formulas for the numbers of spanning trees in the following special classes of graphs. Some of them will be mentioned later. Complete prism Fan Point wheel Ladder Moebius Ladder Cocktail party graph k-dimensional lattice Complete multipartite graph Multi-star related graph Some circulant graphs 14
Figure 5: Two examples of circulant graphs. 2.1 Spanning trees in circulant graphs Let 1 s 1 < s 2 < < s k be integers. Undirected circulant graph C s 1,s 2,,s k n : there are n vertices labeled 0, 1, 2,, n 1, with each vertex i (0 i n 1) adjacent to 2k vertices i ± s 1, i ± s 2,, i ± s k mod n. Examples of two circulant graphs: C5 1,2 and C6 2,3. Directed circulant graph C s 1,s 2,,s k n : digraph on n vertices 0, 1, 2,, n 1; for each vertex i (0 i n 1), there are k arcs from i to vertices i + s 1, i + s 2,, i + s k mod n. 15
Some Recurrence Formulas T (Cn 1,2 ) = nfn, 2 F n are F ibonacci numbers. (Conjectured by Bedrosian (1973), and by Boesch and Wang (1982), proven by Kleitman and Golden (1975), and Prodinger (1986). A much simpler proof given by Yong and Zhang (1994). T (C 1,3 n ) = na 2 n, a n = 2a n 1 + 2a n 3 a n 4, a 1 = 1, a 2 = 2 2, a 3 = 5, a 4 = 5 2. (Yong, Talip and Acenjian, 1997) T (C 2,3 n ) = na 2 n, a n = a n 1 + a n 2 + a n 3 a n 4, a 1 = 1, a 2 = 1, a 3 = 1, a 4 = 3. (Zhang, Yong and Golin, 2000) T ( C 2,3 n ) = na n, a n = a n 1 + 2a n 2 + 2a n 3 4a n 4, a 1 = 1, a 2 = 1, a 3 = 1, a 4 = 5. (Zhang, Yong and Golin, 2000) 16
General Results for Circulant Graphs T (C s 1,s 2,,s k n ) = na 2 n, (Golin, Yong and Zhang, 2000) where a n satisfies a recurrence relation of the form n 2 sk 1, a n = 2 s k 1 i=1 b i a n i. The initial values of a n and coefficients b i (1 i 2 sk 1 ) can be found using Matrix Tree Theorem. T ( C s 1,s 2,,s k n ) = na n, (Golin, Yong and Zhang, 2000) where a n satisfies a linear recurrence relation of order 2 sk 1 with initial conditions and coefficients. When n tends to infinity (Zhang, Yong, 1999) T ( C s 1,s 2,,s k n+1 )/T ( C s 1,s 2,,s k n ) k. Similar result was obtained recently for the undirected case (Golin, Yong, Zhang, 2006). 17
An Example of Combinatorial Consideration Consider the graph L 1,2 n with n vertices {0, 1,, n 1} and with each vertex i (0 i n 2) adjacent to i + 1 and each vertex i (0 i n 3) adjacent to i + 2. L 1,2 n is the multigraph derived from L 1,2 n+1 by combining the first two vertices into one. Then T (Ln 1,2 ) = T (L 1,2 n 1) + T (L 1,2 n 1), T (L 1,2 n ) = T (L 1,2 n 1) + 2T (L 1,2 n 1). with the initial conditions T (L2 1,2 ) = 1 and T (L 1,2 2 ) = 2. Sovling these equations T (L 1,2 n ) = 1 2 5 ((3 5)( 3 + 2 = F 2n 2, 5 where F n are F ibonacci numbers. (Kleitman and Golden, 1975) ) n (3 + 5)( 3 5 ) n ) 2 18
2.2 Spanning Trees in Some Composite Graphs Let G 1 = (V 1, E 1 ) and G 2 = (V 2, E 2 ) be two graphs with disjoint vertex sets. The join G = G 1 + G 2 : V = V 1 V 2, E = E 1 E 2 {uv u V 1, v V 2 }. The lexicographic product G = G 1 [G 2 ]: V = V 1 V 2, E = {(u 1, v 1 )(u 2, v 2 ) u 1 u 2 E 1 or u 1 = u 2 and v 1 v 2 E 2 }. The Cartesian product G = G 1 G 2 : V = V 1 V 2, E = {(u 1, v 1 )(u 2, v 2 ) u 1 = u 2 and v 1 v 2 E 2 or u 1 u 2 E 1 and v 1 = v 2 }. The categorical product G = G 1 G 2 : V = V 1 V 2, E = {(u 1, v 1 )(u 2, v 2 ) u 1 u 2 E 1 and v 1 v 2 E 2 }. The strong product G = G 1 G 2 : V = V 1 V 2, E is the union of the edge sets of the Cartesian product and categorical product of G 1 and G 2. 19
Figure 6: Graphs G 1 and G 2 and their composite graphs. G 1 + G 2 : V = V 1 V 2, E = E 1 E 2 {uv u V 1, v V 2 }; G 1 [G 2 ] : V = V 1 V 2, E = {(u 1, v 1 )(u 2, v 2 ) u 1 u 2 E 1 or u 1 = u 2 and v 1 v 2 E 2 }; G 1 G 2 : V = V 1 V 2, E = {(u 1, v 1 )(u 2, v 2 ) u 1 = u 2 and v 1 v 2 E 2 or u 1 u 2 E 1 and v 1 = v 2 }; G 1 G 2 : V = V 1 V 2, E = {(u 1, v 1 )(u 2, v 2 ) u 1 u 2 E 1 and v 1 v 2 E 2 }; G 1 G 2 : V = V 1 V 2, E = Union of edges in G 1 G 2 and G 1 G 2. 20
L-eigenvalues of Composite Graphs: L-eigenvalues of G are the eigenvalues of its Laplacian matrix of G. Let L-eigenvalues of G 1 : λ 1 (= 0), λ 2,, λ n ; L-eigenvalues of G 2 : µ 1 (= 0), µ 2,, µ m. L-igenvalues of G 1 + G 2 : (join) 0, m+n, λ 2 +m,, λ n +m and µ 2 +n,, µ m +n. L-eigenvalues of K m [G]: (lexicographic p.) 0, mn of order m 1, and λ i + (m 1)n of order m for each i = 2, 3,, n. L-eigenvalues of K p,q [G]: (lexicographic p.) 0, np of order q 1, nq of order p 1, λ i +np of order q and λ i + nq of order p for each i = 2, 3,, n. L-eigenvalues of G[K m ]: (lexicographic p.) mλ i, (d i +1)m of order m 1 for each i = 1, 2,, n. L-eigenvalues of G 1 G 2 : (Cartesian p.) λ i + µ j (i = 1, 2,, n; j = 1, 2,, m). 21
Figure 7: The complete prism R 3 (3) = K 3 C 3. The numbers of spanning trees in composite graphs Complete prism graph R n (m) = K m C n : (Cartesian p.) T (R n (m)) = n m [(m+2+ m 2 +4m 2 ) n + ( m+2 m 2 +4m 2 ) n 2] m 1. (Bedrosian and Prodinger, 1986) 22
Con t Figure 8: The wheel W 7 = K 1 + C 6. Point wheel graph W n = K 1 + C n 1 : (join) T (W n ) = ( 3+ 5 2 ) n 1 + ( 3 5 2 ) n 1 2. (Bedrosian and Prodinger, 1986) 23
Con t Figure 9: The ladder L 5 = K 2 P 5. Ladder graph L n = K 2 P n : (Cartesian p.) T (L n ) = 1 2 3 [(2 + 3) n (2 3) n ]. (Bedrosian and Prodinger, 1986) 24
Con t Figure 10: The Moebius ladder M 5. Moebius ladder graph M n : (Cartesian p.) formed from K 2 P n by adding edge from the first vertex on one copy of P n to the last vertex on the second copy of P n and an edge from the first vertex on the second copy to the last vertex on the first copy. T (M n ) = n 2 [((2 + 3) n + (2 3) n + 2]. (Bedrosian and Prodinger, 1986) 25
Con t Figure 11: A graph isomorphic to P 5 P 5. Consider the graph on mn vertices {(x, y) 1 x m, 1 y n}, with (x, y) adjacent to (x, y ) if and only if x x = y y = 1. This graph is isomorphic to P m P n (categorical p.) which consists of two disjoint subgraphs EC m,n OC m,n = {(x, y) x + y is even}, = {(x, y) x + y is odd}. If mn is even, then EC m,n and OC m,n are isomorphic. Stanley (1996) conjectured that T (OC 2n+1,2n+1 ) = 4T (EC 2n+1,2n+1 ) and Knuth (1997) proved it. 26
3 Graphs with maximum number of spanning trees G(n, e): class of graphs with n vertices and e edges. t-optimal graph: has maximum number of spanning trees among G(n, e). The general problem of finding t-optimal graph is open. Partial known results: A cycle in which each edge is replaced by k multiple edges has less trees than any other 2k-connected graph with the same numbers of vertices and edges. (Lomonosov and Polesskiĭ, 1972) A graph is called almost-regular if the degrees of any two vertices differ by no more than one. Any t-optimal graph must be almost-regular. (Leggett and Bedrosian, 1965) 27
Figure 12: An exemplification for t-optimal graph. Example. Remove three edges from complete graph K 6. All possible configurations of the removed edges are shown in Figure 12. Each deleted case actually represents different equivalent cases. The corresponding graphs have spanning trees: 384, 360, 336, 324, 300. Case 1 generates a t-optimal graph. 28
A few more results In removal of m edges (m n/2) from the complete graph K n, the retained graph is t- optimal when the removed edges are not adjacent. (Moustakides and Bedrosian, 1980) If G is a complete s-partite graph, then G is the unique simple graph that has the maximum number of spanning trees among graphs with same numbers of vertices and edges. (Cheng, 1981) Most recent papers are for very special graphs: t-optimal graph in G(n, e), e = an + b, where a, b are consts. 29
4 Enumerating spanning trees Let N = # of spanning trees in G. For graphs, Gabow and Myers (1978) gave an algorithm in O(NV ) time. This algorithm is optimal if all spanning trees are required to be output explicitly. Kapoor and Ramesh designed an algorithm (1991) which runs in O(N + V + E) time and uses O(V E) space. In their algorithm, the spanning trees are not output explicitly. For weighted graphs, Gabow (1977) gave an algorithm that outputs sorted trees in O(NE + N log N) time. Later, Kapoor and Ramesh (1995) improved it to O(N log V + V E). For digraphs, Kapoor and Ramesh (2000) gave an algorithm which has running time O(NV + V 3 ) and needs O(V 2 ) space. 30
No efficient algorithm developed for enumerating all spanning trees in a graph The aim of the algorithm for enumerating all spanning trees in a graph G is to construct the computation tree C(G). The computation tree suffices to generate all spanning trees of G. Each vertex x of C(G) has a spanning tree S x of G associated with it. The root of C(G) can be any spanning tree. Repetitions of spanning trees are avoided by maintaining two sets, IN and OUT, at each node of C(G) and using inclusion/exclusion principle. For the root r of C(G), IN r and OUT r are both empty. 31
Figure 13: The part of computation tree C(G). (Con t) Let x be any vertex of C(G). f is an edge of G. f S x and f OUT x. Let the fundamental cycle of f with respect to S x contain the following edges of S x IN x : (e 1, e 2,, e k ). Then x has sons B i, 1 i k + 1. For 1 i k, B i corresponds to the spanning tree obtained by replacing e i by f. B k+1 corresponds to the tree same with S x. For the sons of x, the IN and OUT sets are defined as: IN Bj OUT Bj IN Bk+1 OUT Bk+1 = IN x {e 1, e 2,, e j 1 } {f}, for 1 j k = OUT x {e j }, for 1 j k = IN x = OUT x {f} 32
The Techniques used mostly are: Combinatorial Analysis Graph Spectra Matrix Theory 33
The Difficulities of the Problem are: Combinatorial approaches can only attack those very special (di-)graphs. Algebraic approaches involve in estimating the distribution of eigenvalues. This is usually hard for large graphs. Enumurating Methods obtained so far are exponential in complexity. New method? 34
Therefore, bounding the number of spanning trees Lower bounding the number Upper bounding the number Asymptotic analysis BUT THE BOUNDS OBTAINED ARE VERY ROUGH! 35
5 Research trends Research about the number of spanning trees is continuing and very active. Possible Problems would be: Find more special graphs in application and count the number of spanning trees. Analyze the asymptotic properties of the number of spanning trees. Solve the t-optimal graph problem. Design efficient algorithms for enumerating the spanning trees in directed graphs. 36