Counting of Spanning Tree
Kirchhoff Matrix
Select a labeling map $\mu:\lbrace 1,2,\cdots,\nu(G)\rbrace\to V(G)$ which is an one-to-one map mapping an index to a vertex in graph $G$, define the Kirchhoff Matrix of $G$ as:
where $\text{cnt}(\mu(i),\mu(j))$ represent the amount of edges connecting vertex $m$ and $n$ (if $G$ is a simple graph, $cnt(m,n)\in\lbrace0,1\rbrace$).
We abbreviate $K(G,\mu)$ as $K(G)$ or $K$ if $G$ and $\mu$ is already clarified.
Property I
Since the sum of every row and column of $K(G)$ equals $0$, so $\text{det}(K(G))=0$ .
Property II
If $\omega(G)>1$, then the determinant of every principal sub-matrix of $K(G)$ with order $n-1$ equals $0$, where $\omega(G)$ denotes the amount of connected branches of $G$.
Prove:
Since $G$ can be divided into $\omega(G)$ connected branches, we can select a labling map $\mu$ such that
where $K_i$ represents the Kirchhoff matrix of the $i$-th connected branch of $G$, whose determinant is of course zero.
We using $C_r(K)$ denoting the sub-matrix gained through removing the $r$-th row and $r$-th column of $K$.
Assuming the vertex $\mu(r)$ we removed is the $j$-th vertex of the $s$-th connected branch, we have:
This is obviously since $\omega(G)>1$ and there are at least $\omega(G)-1$ zero factors.
Property III
If $G$ is a tree, thus $\forall r\in\lbrace1,2,\cdots,n\rbrace,\text{det}\left(C_r\left(K(G)\right)\right)=1$ .
Prove:
Set the removed vertex $\mu(r)$ as a root, and sort the other vertices by the depth (the distance to root) from mint to max (the order between two vertice having same depth can be treated arbitrarily), we gain:
Meanwhile, applying this sorted order to labeling map as $\mu’(i)=\mu(a_i)$, and gain:
Assuming vertex $\mu’(s)$ has $m$ children, denoted as $\mu’(b_1),\mu’(b_2),\cdots,\mu’(b_m)$ , define an operation as adding $b_1$-th column,$b_2$-th column,…,$b_m$-th column to $b_s$-th column in $K’$. We perform this operation by the order of depth max to min (namely from the right of matrix to the left).
We say an $i$-th column is fine if and only if $k’_{i,i}=1$ and $\forall j\in\lbrace i+1,i+2,\cdots,\nu-1\rbrace,k’_{j,i}=0$.
For a leaf vertex $\mu’(l)$, since it is in the maximum depth, and it just has its only parent as neighbours, so $k’_{l,l}=1$ and there is no non-zero entries below $k’_{l,l}$. $\mu’(l)$ is already fine.
Applying the proposed operation will cause $s$-column reaches fine if all its child is fine (the fine $b_i$-th column will have a $+1$ at $k’_{b_i,b_i}$ to diminish the $-1$ at $k’_{b_i,s}$, while decreaing $k’_{s,s}$ by $1$ through $b_{s,b_i}$)
So, recursively, after all the operation, every column reaches fine and the matrix transform into a upper-triangular matrix whose diagonal is all ones. Noting that the operation is elementary, so determinant is kept unchanges, which implies:
Incidence Matrix:
Selecting both a labeling map $\mu:\lbrace1,2,\cdots,\nu(G)\rbrace$ for vertices and a labeling map $\mu:\lbrace1,2,\cdots,m(G)\rbrace$ for edges. The incidence matrix $B(G,\mu,\theta)=(b_{i,j})_{\nu(G)\times m(G)}$ of graph $G$ is defined by: If $\exists\theta(j)$ connects $\mu(p),\mu(q)$, then $\lbrace b_{p,j},b_{q,j}\rbrace=\lbrace -1,1\rbrace$ (which one is $1$ and which one is $-1$ is not important), the other entries are all $0$.
It can be easily seen that $K(G)=B(G)B(G)^T$ by the definition.
Matrix-Tree Theorem
namely the determinant of an arbitrary $n-1$ order principal sub-matrix of $K(G)$ equals the amount of all spanning trees of $G$.
Prove:
Denoting $B_r$ as the matrix gained by getting rid of the $r$-th row of $B(G)$. Obviously $C_r(K)=B_rB_r^T$
With Cauchy-Binet Formula:
Let
and make a abbreviated notion:
We have:
In fact $B_r^x(B_r^x)^T$ is a $\nu-1$ order principal sub-matrix of a $\nu$ order Kirchhoff matrix, we have $\text{det}\left(B_r^x(B_r^x)^T\right)=1$ if adding $\theta(x_1),\theta(x_2),\cdots,\theta(x_{\nu-1})$ to the empty graph of $V(G)$ is a tree, or else $\text{det}\left(B_r^x(B_r^x)^T\right)=0$ (since there are $\nu-1$ edges which is the minimal requirement for a completely connected graph).
So if we compute the $\text{det}(C_r(K))$, it will automatically traverse any possible sub graph of $G$ with $\nu-1$ edge and self-add $1$ if it find a tree. Thus
An Example
Define a Wheel Graph as $W_n=C_n\lor v_o$ where $v_o$ is a single vertex and $C_n$ is a $n$-cycle, please calculate the $\tau(W_n)$:
Set $\mu$ as mapping vertices on $C_n$ to $\lbrace 1,2,\cdots,n\rbrace$ and $v_o$ to $n+1$. We have the $K(W_n)$ as:
Get rid of the $n+1$-th row and column, we have:
The trick here is setting the target term as $S_n$, Let $P_n$ be
Expand $S_n$ and $P_n$, we have: