Spanning Trees When Edges Repeat
For a simple graph, an edge is determined by its pair of endpoints. In a multigraph, several distinct edge instances may join the same two vertices, and an edge may have both endpoints at the same vertex: such an edge is a loop. These possibilities do not change the basic idea of a spanning tree, but they do affect how trees are counted. In particular, parallel edges represent distinct choices, while loops represent no valid choice in a tree.
Write \(t(G)\) for the number of spanning trees. Throughout, \(G\) has at least one vertex. If \(G\) is disconnected, \(t(G)=0\); for a graph with one vertex, the empty edge set is a spanning tree, so \(t(G)=1\), even if the graph also has loops. When edge instances are listed, labels such as \(e_1,e_2\) distinguish parallel edges.
What Loops and Parallel Edges Do
Proof. A spanning tree is acyclic, so it cannot contain a loop, since a loop is itself a cycle. Therefore every spanning tree of \(G\) is a spanning tree of \(G-e\) when \(e\) is a loop. Conversely, deleting a loop removes no spanning tree, because none used \(e\). This gives a bijection and hence \(t(G)=t(G-e)\).
For parallel edges, regard each edge instance as a separate element of the edge set. A spanning tree that contains one particular instance remains a different edge set if that instance is replaced by another parallel instance, provided the replacement is the only chosen edge between those endpoints. More generally, the count is over edge-instance subsets, not just over endpoint pairs. A tree cannot contain two parallel instances together because they form a cycle of length two. \(\square\)
This distinction is important in deletion–contraction. For a nonloop edge instance \(e\), the recurrence is \(t(G)=t(G-e)+t(G/e)\), where \(G/e\) contracts the endpoints of \(e\). All other edge instances are retained: parallel edges to \(e\) become loops after contraction, and other parallel edges remain distinct. Trees not containing \(e\) are counted by \(G-e\); trees containing \(e\) correspond, after contracting \(e\), to trees of \(G/e\). The loops created by contraction cannot belong to those trees, just as the corresponding redundant edges could not be included alongside \(e\) in a tree of \(G\).
Worked Example: Parallel Edges Between Two Vertices
Let \(V=\{u,v\}\). Let \(E\) consist of three distinct parallel edge instances \(e_1,e_2,e_3\) joining \(u\) to \(v\), two loops at \(u\), and one loop at \(v\). Find \(t(G)\).
A connected spanning subgraph must contain an edge between \(u\) and \(v\). It cannot contain two such edges, because they would form a cycle of length two, and it cannot contain a loop. Thus the spanning trees are exactly \(\{e_1\}\), \(\{e_2\}\), and \(\{e_3\}\), giving \(t(G)=3\).
Check: deleting the three loops leaves three parallel choices and does not change the count. Alternatively, apply deletion–contraction to \(e_1\): deleting it leaves two choices, while contracting it leaves one vertex with loops only, whose spanning-tree count is \(1\). The recurrence gives \(2+1=3\).
The Laplacian Convention for a Multigraph
To compare direct counting with a cofactor calculation, the Laplacian must encode edge multiplicities. Orient each nonloop edge instance arbitrarily and give it an incidence column with a \(+1\) at one endpoint and a \(-1\) at the other. Give each loop the zero column. If \(B\) is the resulting incidence matrix, define \(\mathbf L(G)=BB^{\mathsf T}\). Reversing an edge orientation changes the sign of one column but does not change \(BB^{\mathsf T}\).
This convention agrees with \(\mathbf L=\mathbf D-\mathbf A\) if loops contribute \(2\) to the degree and the adjacency-matrix diagonal entry for each loop is also \(2\). The two contributions cancel in \(\mathbf D-\mathbf A\). Using incidence columns makes the loop cancellation explicit and avoids ambiguity about adjacency-matrix conventions. Parallel edges each contribute separately, so their multiplicity appears in the entries of \(\mathbf L\).
Proof. Fix a vertex \(r\). Delete the row of \(r\) from the incidence matrix \(B\), obtaining \(B_r\). Deleting row \(r\) and column \(r\) from \(BB^{\mathsf T}\) gives \(B_rB_r^{\mathsf T}\). By the Cauchy–Binet formula, for an \(n\)-vertex graph with \(m\) edge instances,
Here \(B_r[:,S]\) is the square matrix formed from the columns for the edge instances in \(S\). If \(S\) contains a loop, its column is zero, so its determinant is zero. If \(S\) contains a cycle, the signed sum of the incidence columns around that cycle is zero; this also applies to a cycle made of two parallel edges. Therefore its columns are dependent and its determinant is zero.
Now suppose the \(n-1\) edge instances in \(S\) contain no cycle. They form a forest. A forest on \(n\) vertices with \(c\) components has \(n-c\) edges: each component with \(q\) vertices is a tree and has \(q-1\) edges, and summing over components gives \(n-c\). Since \(S\) has \(n-1\) edges, \(n-c=n-1\), so \(c=1\). Thus \(S\) is a spanning tree.
For a spanning tree \(S\), \(\det(B_r[:,S])\) is \(1\) or \(-1\). To verify this, if \(n=1\), the matrix is empty and its determinant is \(1\). If \(n>1\), the tree has a leaf different from \(r\): a tree with at least two vertices has at least two leaves, so at least one is not \(r\). The row of this leaf has just one nonzero entry, equal to \(1\) or \(-1\). Expanding the determinant along that row reduces its absolute value to the determinant for the smaller tree obtained by removing the leaf and its incident edge. Repeating this step ends at the one-vertex case, giving absolute value \(1\).
Consequently, each spanning tree contributes \(1\) to the Cauchy–Binet sum, and every other set \(S\) contributes \(0\). The sum is exactly the number of spanning trees. If \(G\) is disconnected, no such \(S\) can be a spanning tree, so the determinant and \(t(G)\) are both zero. This proves the formula for every \(n\ge1\), including \(n=1\). \(\square\)
Matching the Two Counting Methods
Worked Example: A Triangle with Unequal Multiplicities
Let \(V=\{1,2,3\}\). There are two edge instances joining \(1\) to \(2\), three joining \(2\) to \(3\), and one joining \(1\) to \(3\). Also include one loop at \(1\). Find \(t(G)\) by direct enumeration and by a Laplacian cofactor.
For direct enumeration, a tree on these three vertices must use exactly two of the three endpoint pairs. If it uses the \(12\) and \(23\) pairs, there are \(2\cdot3=6\) choices of edge instances. If it uses \(12\) and \(13\), there are \(2\cdot1=2\) choices. If it uses \(23\) and \(13\), there are \(3\cdot1=3\) choices. These cases are disjoint and exhaustive, so \(t(G)=6+2+3=11\). The loop is excluded from every tree.
For the Laplacian, the numbers of nonloop edge instances at vertices \(1,2,3\) are \(3,5,4\), respectively: \(1\) has two edges to \(2\) and one to \(3\); \(2\) has two to \(1\) and three to \(3\); \(3\) has three to \(2\) and one to \(1\). The loop contributes zero. Therefore
Delete row and column \(3\). The cofactor determinant is \(3\cdot5-(-2)(-2)=15-4=11\). It agrees with the direct count. This calculation shows why replacing the two \(12\)-edges by one edge would be incorrect: the multiplicity \(2\) appears in the off-diagonal entry and in the distinct choices counted directly.
Check: the three direct cases give \(6+2+3=11\), while the cofactor gives \(15-4=11\). The two methods count the same edge-instance trees.
Worked Example: Parallel Bundles on a Tree-Shaped Graph
Let \(V=\{a,b,c,d\}\). Include two edge instances between \(a\) and \(b\), three between \(a\) and \(c\), and one between \(a\) and \(d\). Add one loop at \(a\) and one loop at \(c\). Find the spanning-tree count.
Every spanning tree must connect each of \(b,c,d\) to the rest of the graph. The only available connections for those vertices are their respective bundles to \(a\). A tree therefore chooses one of the two \(ab\)-edges, one of the three \(ac\)-edges, and the single \(ad\)-edge. The loops cannot be chosen. This gives \(2\cdot3\cdot1=6\) spanning trees.
For the cofactor calculation, delete the row and column of \(a\). The remaining diagonal entries count the incident nonloop edge instances at \(b,c,d\), and there are no edges among those three vertices. Thus the reduced matrix is diagonal with entries \(2,3,1\), and its determinant is \(2\cdot3\cdot1=6\).
Check: there are six independent combinations of the required branch choices, and the reduced determinant is \(6\). Both calculations give \(t(G)=6\); neither loop changes the result.
Common Pitfall: Simplifying Before Counting
A frequent error is to replace every bundle of parallel edges by a single edge before counting. In the two-vertex example, that would leave one connection and lead to the incorrect count \(1\), rather than the actual count \(3\). The simplified graph records whether a connection exists, but loses which edge instance was selected. It can represent the underlying connectivity, but it cannot preserve the edge-instance spanning-tree count unless the multiplicities are retained separately.
A related error is to add a loop to a diagonal entry of \(\mathbf L\) while leaving the other matrix entries unchanged. Under the incidence convention, a loop has a zero column and contributes nothing to \(\mathbf L\). If using \(\mathbf D-\mathbf A\), use a consistent convention: count each loop twice in both the degree and the adjacency diagonal so the contributions cancel. The cofactor formula then agrees with direct enumeration, which never includes loops in a spanning tree.
Check Your Understanding
In each question, treat parallel edge instances as distinct choices and loops as cycles.
- A graph has two vertices joined by four parallel edges and no other edges. How many spanning trees does it have? Explain why.
- Why does deleting a loop preserve the spanning-tree count, even if the loop is the only edge incident to its vertex?
- Three vertices have two parallel edges between each pair, and there are no loops. Count the spanning trees directly by choosing endpoint pairs and edge instances.
- State how a loop and a bundle of \(p\) parallel edges contribute to the incidence-defined Laplacian.
- For a disconnected multigraph with at least one vertex, what does the multigraph cofactor formula give, and why?