Open In App

Number of spanning trees of a weighted complete Graph

Prerequisites: Graph Theory Basics, Spanning tree.

Complete Weighted Graph: A graph in which an edge connects each pair of graph vertices and each edge has a weight associated with it is known as a complete weighted graph. 



The number of spanning trees for a complete weighted graph with n vertices is n(n-2).

Proof: Spanning tree is the subgraph of graph G that contains all the vertices of the graph. Therefore, the number of spanning trees of a complete weighted graph is the same as the number of labeled trees (need not be binary) with n vertices.



The Prüfer sequence of a labeled tree of n vertices is a unique sequence of length (n-2) associated with the tree. Also, for a given Prüfer sequence of length (n-2) on the labels 1 to n, there is a unique labeled tree with the given Prüfer sequence. Therefore, we have a bijection between the set A of labeled trees with n vertices and the set B of Prüfer sequences of size n-2 on the labels 1 to n. This can be proved as follows –

Let T be a labeled tree with vertices 1,2,…,n, and S as a Prüfer sequence of size (n-2). Thus, T and S are the elements of sets A and B, respectively.

(i) Labeled tree (T) –> Prufer sequence (S)

Constructing the Prüfer sequence of a labeled tree – 

Initially, let S = NULL.

Procedure –

Observations –

(ii) Prufer Sequence (S) –> Labeled Tree (T)

Constructing the labeled tree from its Prüfer sequence

Procedure-

The tree obtained from S is the same as T. Therefore, Prüfer sequence S of size (n-2) is analogous to T ( S <–> T ). Hence, there is a bijection between the set of labeled trees with n vertices and the set of Prüfer sequences of size (n-2) on the labels 1 to n.

Thus, the number of spanning trees of a complete weighted graph of n vertices = number of labeled trees with n vertices = number of Prüfer sequences of size (n-2) = n(n-2).

Article Tags :