You are on page 1of 5

CS7540 Spectral Algorithms, Spring 2017 Lecture #2

Matrix Tree Theorem


Presenter: Richard Peng Jan 12, 2017

DISCLAIMER: These notes are not necessarily an accurate representation of what


I said during the class. They are mostly what I intend to say, and have not been carefully
edited.

• Next week: Richard away.

– Tuesday: Anup Rao on eigenvalues,


– Thursday: Antonio Blanca on Random Walks.

• Last time:

– Give more background on the materials.


– Too many new concepts (mostly math), more details to formulas: review linear
algebra notes.
– Write down collaboration policy: should be there now.

• Today: matrix tree theorem, graph Laplacians, Schur complements.

The problem that we’ll discuss is counting the number of spanning trees in a graph.
We’ll actually need the weighted version, so for a graph where edges have weight we , the
weight of a tree is
def
Y
w(T ) = we ,
e∈T

and the total weight of trees in a graph is:


def
X
T (G) = w(T ).
T ∈T (G)

For example the triangle graph with edge weights 1, 2, and 3 has weight

1 × 2 + 2 × 3 + 3 × 1 = 2 + 6 + 3 = 11.

Counting spanning trees is related to the generation of a random spanning trees, which
is in turn used in approximation algorithms. This connection between determinant and
combinatorial objects in turn has a variety of uses in the study of other combinatorial
objects.
We will show that the number of spanning trees can be computed using the determi-
nant of a matrix, which also underlies many other things in spectral graph theory:

1
Definition 0.1. Given an undirected graph G, define its graph Laplacian as a n × n
matrix L with entries given by:
P
 x6=u wux if u = v

def
Luv = −wuv if u 6= v and uv ∈ E .

0 otherwise

The matrix-tree theorem states that the determinant of the first n − 1 rows/columns
of L gives the total weight of all trees.

Theorem 0.2 (Matrix-Tree Theorem). Let L1:n−1,1:n−1 be the minor containing the first
n − 1 rows and columns of L. We have:

T (G) = det(L1:n−1,1:n−1 )

For the graph above with edge weights 1, 2 and 3, the graph Laplacian is:
 
3 −1 −2
 −1 4 −3  ,
−2 −3 5

The top left 2-by-2 minor is  


3 −1
,
−1 5
and its determinant is 3 × 4 − (−1) × (−1) = 11. You can check that the other 2 minors
(by removing different vertices) also has determinant 11.
There are many proofs of the matrix-tree theorem. I will show one that’s algorithmic,
and very much related to numerical operations, specifically Gaussian elimination.
The simplest case is n = 2, in this case there is only one possible tree, and its weight
equals to the (weighted) degree of both vertices.
For bigger n, it is useful to consider how we can compute determinants. The standard
operation done to matrices is a row operation, or its analog in columns. We take a
row/column, and add / subtract it to/from another row or column. The following facto
makes the connection to row operations crucial:

Fact 0.3. Row/column operations does not change the determinant.

This means we can find the determinant of the graph Laplacian by picking a ver-
tex, and eliminate it by adding/subtracting it to the non-zero off-diagonal entries in its
row/column. For the matrix  
3 −1 −2
 −1 4 −3  ,
−2 −3 5

2
we can remove the −1 in row 2, column 1 by adding 1/3 copies of the first row to the
second, giving:  
3 −1 −2
 0 3.66 −3.66  ,
−2 −3 5
and the −2 can be removed similarly by adding 2/3 copies of the first row to the second,
giving:  
3 −1 −2
 0 3.66 −3.66  .
0 −3.66 3.66
After we do this, we can remove the −1 and −2 in row 1 for free by adding copies of the
3 to it, leading to the matrix
 
3 0 0
 0 3.66 −3.66  .
0 −3.66 3.66
Note that the bottom-right 2 × 2 matrix is still a graph Laplacian. For a formal proof
that graphs are closed under Schur complements, the following definition is useful:
Lemma 0.4. A matrix is a graph Laplacian if and only if:
• It’s symmetric.

• Row sums and column sums are all 0.

• All off-diagonal entries are non-positive.


With this in mind, we can see that row/column operations produce graph Laplacians
because:
• It keeps row/column sums the same.

• It only subtracts from off-diagonal entries.


A closer look also gives that for a vertex with neighbors 1 . . . k with edge weights w1 . . . wk ,
this elimination operation creates, for each pair of neighbors i and j, an edge of weight
ww
Pi j .
x wx

This way of removing a vertex generates what’s called a Schur Complement. This has
a slightly messy algebraic definition, but can also be defined as the object formed by
removing vertices in this order.
Note that in the above example, the determinant of the new matrix is still

3 × 3.666666666666666 = 11.

3
This, plus the fact that we have the matrix-tree theorem in the n = 2 case suggests an
inductive approach: we repeatedly remove vertices, and show that the Schur complement
formed by removing that vertex has a tree count related to the tree count of the original
graph.
Lemma 0.5. Let Schur(G, u) be a graph obtained from G by pivoting out a vertex u with
weighted degree d(u) Then

T (G) = d(u) × T (Schur(G, u)).

This Lemma implies the matrix tree theorem because we can now do induction on the
value of n, and apply the matrix tree theorem on the smaller Schur(G, u).
To show this inductive step, it suffices to show a bijection between trees in Schur(G, u)
and trees in G. There are two kinds of edges in Schur(G, u):
• Those added from the clique formed by pivoting u, we’ll denote these with K.

• Those in G that does not involve u, we’ll denote these with G− .


In addition, we can denote the neighborhood of u by N (u).
A tree in either G or Schur(G, u) can be broken into two parts: a forest in H 0 , and
another forest in either N (u) or K.
The formal statement that we will show is:
Lemma 0.6. For any forest F of G− , we have
X X
w(T ) = d(u) · w(T 0 )
T is spanning tree of G, F ⊆ T T 0 is spanning tree of Schur(G, u), F ⊆ T 0

As a sanity check, suppose there is only 1 connected component, then this tree is done
if we’re working on H. But in G, we still need to connect u to one of these vertices, and
there are d(u) ways of doing this.
In the remaining time (if there is any), we will give a proof sketch of this Lemma:
• Any forest will produce connected components, let it be S1 . . . St .

• The number of ways to connect u to Si is


X
wuv ,
v∈Si

which we’ll define as w(Si ).

• As these are picked independently, the total weight over trees is


t
Y
w(Si ).
i=1

4
• For clique edges on the other hand, the total weight of edges between Si and Sj is:

w(Si ) × w(Sj )
d(u)

• This is a product demand graph. So by proofs like Prufer sequences, it can be shown
that the total weight of spanning trees there is
t  
Y w(Si ) 1 Y
d(u)t−1 = w(Si ).
i=1
d(u) d(u) i

The weight of spanning trees of a product-demand graph can be given by a generaliza-


tion of Cayley’s formula. It can be proven using https://en.wikipedia.org/wiki/Prüfer sequence.
Details on it is in the problem set.

You might also like