COUNTING AND ENUMERATINGSPANNING 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 ofD. 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 unorderedpair of verties. (u, v) = (v, u)
• Self-loop, Path and Cycle, Degree of aVertex u, Connected Graph, Tree
• Example:
2
• A spanning tree in a graph G is a tree hav-ing same vertex set as G.
• A spanning tree in a digraph D is a rootedtree with the same vertex set as D: there isa vertex specified as the root, and from theroot there is a path to any of verties of Dand no cycle.
Multiple edges and self-loops are permitted inany (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 manyspanning trees does it have?
4
The number of spanning trees paid much at-
tention.
• 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 G1 and G2.
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
G1 = G with e deleted;
G2 = G with u and v contracted together.
Then
T (G) = T (G1) + T (G2).
So what?
7
– Algebraically
We need some definitions.
∗ Given G with vertex set {v1, v2, · · · , vn}.The adjacency matrix A of G is a n×n ma-
trix whose (i, j)-entry is aij where aij is the
number of edges between vi and vj.
∗ For matrix A = (aij)n×n, the cofactor of the
(i, j)-entry is (−1)i+j det Aij where Aij 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(d1, d2, · · · , dn)
where di is the degree of vi.
8
– Matrix Tree Theorem–a very basic theorem
(Kirchhoff, 1847)
Let H = B −A. Then T (G) is equal to any co-
factor of H . H is usually called Kirchhoff ma-
trix, 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 eigenval-
ues 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: 25 × 54 = 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 count-
ing 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 Kn: T (Kn) =
nn−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 ≤ s1 < s2 < · · · < sk be integers.
– Undirected circulant graph Cs1,s2,···,skn : there are
n vertices labeled 0, 1, 2, · · ·, n− 1, with each
vertex i (0 ≤ i ≤ n− 1) adjacent to 2k vertices
i± s1, i± s2, · · · , i± sk mod n.
Examples of two circulant graphs: C1,25 and C2,3
6 .
– Directed circulant graph ~Cs1,s2,···,skn : 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 + s1, i + s2, · · · , i + sk mod n.
15
Some Recurrence Formulas
– T (C1,2n ) = nF 2
n , Fn are Fibonacci 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 (C1,3n ) = na2
n,
an =√
2an−1 +√
2an−3 − an−4,
a1 = 1, a2 = 2√
2, a3 = 5, a4 = 5√
2.
(Yong, Talip and Acenjian, 1997)
– T (C2,3n ) = na2
n,
an = an−1 + an−2 + an−3 − an−4,
a1 = 1, a2 = 1, a3 = 1, a4 = 3.
(Zhang, Yong and Golin, 2000)
– T (~C2,3n ) = nan,
an = an−1 + 2an−2 + 2an−3 − 4an−4,
a1 = 1, a2 = 1, a3 = 1, a4 = 5.
(Zhang, Yong and Golin, 2000)
16
General Results for Circulant Graphs
– T (Cs1,s2,···,skn ) = na2
n, (Golin, Yong and Zhang,
2000)
where an satisfies a recurrence relation of the
form ∀n ≥ 2sk−1, an =∑2sk−1
i=1 bian−i.
The initial values of an and coefficients bi (1 ≤i ≤ 2sk−1) can be found using Matrix Tree The-
orem.
– T (~Cs1,s2,···,skn ) = nan, (Golin, Yong and Zhang,
2000)
where an satisfies a linear recurrence relation of
order 2sk−1 with initial conditions and coefficients.
– When n tends to infinity (Zhang, Yong, 1999)
T (~Cs1,s2,···,skn+1 )/T (~Cs1,s2,···,sk
n ) → k.
Similar result was obtained recently for the undi-
rected case (Golin, Yong, Zhang, 2006).
17
An Example of Combinatorial Consideration
Consider the graph L1,2n with n vertices {0, 1, · · · , n − 1}
and with each vertex i (0 ≤ i ≤ n − 2) adjacent to i + 1and each vertex i (0 ≤ i ≤ n − 3) adjacent to i + 2. L
′1,2n
is the multigraph derived from L1,2n+1 by combining the first
two vertices into one. Then
T (L1,2n ) = T (L1,2
n−1) + T (L′1,2n−1),
T (L′1,2n ) = T (L1,2
n−1) + 2T (L′1,2n−1).
with the initial conditions T (L1,22 ) = 1 and T (L
′1,22 ) = 2.
Sovling these equations
T (L1,2n ) =
1
2√
5((3−
√5)(
3 +√
5
2)n − (3 +
√5)(
3−√
5
2)n)
= F2n−2,
where Fn are Fibonacci numbers.
(Kleitman and Golden, 1975)
18
2.2 Spanning Trees in Some Composite Graphs
Let G1 = (V1, E1) and G2 = (V2, E2) be two graphs withdisjoint vertex sets.
– The join G = G1 + G2: V = V1 ∪ V2, E = E1 ∪ E2 ∪{uv|u ∈ V1, v ∈ V2}.
– The lexicographic product G = G1[G2]: V = V1 × V2,E = {(u1, v1)(u2, v2)|u1u2 ∈ E1 or u1 = u2 and v1v2 ∈E2}.
– The Cartesian product G = G1 × G2: V = V1 × V2,E = {(u1, v1)(u2, v2)|u1 = u2 and v1v2 ∈ E2 or u1u2 ∈E1 and v1 = v2}.
– The categorical product G = G1 · G2: V = V1 × V2,E = {(u1, v1)(u2, v2)|u1u2 ∈ E1 and v1v2 ∈ E2}.
– The strong product G = G1 ⊗ G2: V = V1 × V2, E isthe union of the edge sets of the Cartesian product andcategorical product of G1 and G2.
19
Figure 6: Graphs G1 and G2 and their composite graphs.
G1 + G2 : V = V1 ∪ V2,
E = E1 ∪ E2 ∪ {uv|u ∈ V1, v ∈ V2};G1[G2] : V = V1 × V2,
E = {(u1, v1)(u2, v2)|u1u2 ∈ E1 or u1 = u2 and v1v2 ∈ E2};G1 ×G2 : V = V1 × V2,
E = {(u1, v1)(u2, v2)|u1 = u2 and v1v2 ∈ E2
or u1u2 ∈ E1 and v1 = v2};G1 ·G2 : V = V1 × V2,
E = {(u1, v1)(u2, v2)|u1u2 ∈ E1 and v1v2 ∈ E2};G1 ⊗G2 : V = V1 × V2,
E = Union of edges in G1 ×G2 and G1 ·G2.
20
L-eigenvalues of Composite Graphs:
L-eigenvalues of G are the eigenvalues of its Lapla-
cian matrix of G. Let
L-eigenvalues of G1: λ1(= 0), λ2, · · ·, λn;
L-eigenvalues of G2: µ1(= 0), µ2, · · ·, µm.
L-igenvalues of G1 + G2: (join)
0, m+n, λ2+m, · · ·, λn+m and µ2+n, · · ·, µm+n.
L-eigenvalues of Km[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 Kp,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[Km]: (lexicographic p.)
mλi, (di+1)m of order m−1 for each i = 1, 2, · · · , n.
L-eigenvalues of G1 × G2: (Cartesian p.) λi + µj
(i = 1, 2, · · · , n; j = 1, 2, · · · , m).
21
Figure 7: The complete prism R3(3) = K3 × C3.
The numbers of spanning trees in compos-
ite graphs
– Complete prism graph Rn(m) = Km×Cn: (Carte-
sian p.)
T (Rn(m)) =nm[(m+2+
√m2+4m
2 )n + (m+2−√
m2+4m2 )n − 2]m−1.
(Bedrosian and Prodinger, 1986)
22
Figure 8: The wheel W7 = K1 + C6.
Con’t
∗ Point wheel graph Wn = K1 + Cn−1: (join)
T (Wn) = (3+√
52 )n−1 + (3−
√5
2 )n−1 − 2.
(Bedrosian and Prodinger, 1986)
23
Figure 9: The ladder L5 = K2 × P5.
Con’t
∗ Ladder graph Ln = K2 × Pn: (Cartesian p.)
T (Ln) = 12√
3[(2 +
√3)n − (2−
√3)n].
(Bedrosian and Prodinger, 1986)
24
Figure 10: The Moebius ladder M5.
Con’t
∗ Moebius ladder graph Mn: (Cartesian p.)
formed from K2 × Pn by adding edge from
the first vertex on one copy of Pn to the last
vertex on the second copy of Pn and an edge
from the first vertex on the second copy to the
last vertex on the first copy.
T (Mn) = n2 [((2 +
√3)n + (2−
√3)n + 2].
(Bedrosian and Prodinger, 1986)
25
Figure 11: A graph isomorphic to P5 · P5.
Con’t
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 Pm ·Pn (categorical p.) which consists
of two disjoint subgraphs
ECm,n = {(x, y)|x + y is even},OCm,n = {(x, y)|x + y is odd}.
If mn is even, then ECm,n and OCm,n are isomor-
phic. Stanley (1996) conjectured that
T (OC2n+1,2n+1) = 4T (EC2n+1,2n+1)
and Knuth (1997) proved it.
26
3 Graphs with maximum number of span-
ning trees
– G(n, e): class of graphs with n vertices and e
edges.
– t-optimal graph: has maximum number of span-
ning 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 Polesskii, 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 K6. All possible configurations of the re-
moved 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 Kn, the retained graph is t-
optimal when the removed edges are not ad-
jacent.
(Moustakides and Bedrosian, 1980)
∗ If G is a complete s-partite graph, then G is
the unique simple graph that has the maxi-
mum 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 al-
gorithm in O(NV ) time. This algorithm is opti-
mal if all spanning trees are required to be output
explicitly. Kapoor and Ramesh designed an algo-
rithm (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 al-
gorithm 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 enu-
merating 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 Sx of
G associated with it. The root of C(G) can be
any spanning tree.
– Repetitions of spanning trees are avoided by main-
taining two sets, IN and OUT , at each node
of C(G) and using inclusion/exclusion principle.
For the root r of C(G), INr and OUTr 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 6∈ Sx and f 6∈ OUTx. Let the fundamental
cycle of f with respect to Sx contain the follow-
ing edges of Sx − INx: (e1, e2, · · · , ek). Then x
has sons Bi, 1 ≤ i ≤ k + 1. For 1 ≤ i ≤ k,
Bi corresponds to the spanning tree obtained by
replacing ei by f . Bk+1 corresponds to the tree
same with Sx. For the sons of x, the IN and
OUT sets are defined as:
INBj= INx
⋃{e1, e2, · · · , ej−1}⋃{f}, for 1 ≤ j ≤ k
OUTBj= OUTx
⋃{ej}, for 1 ≤ j ≤ k
INBk+1 = INx
OUTBk+1 = OUTx⋃{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 expo-
nential 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 con-
tinuing 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