Open In App

Cayley’s Formula

Cayley’s Formula: This formula tells how many trees can be constructed with N vertices. It states that there are NN – 2  labeled trees that of N nodes. The nodes are labeled from 1, 2, …, N, and two trees are different if either their structure or labeling is different.

For Example: When N is 4, the number of labeled trees is 44 – 2= 16.



Below is the image depicting the number of labeled trees:



In the above image, there are 4 nodes given from which 16 labeled trees are created.

Cayley’s formula derived using Prüfer Codes:

Prüfer Code:

Below are the steps to calculate the Prüfer Code of the following graph:

Thus, the Prüfer code of the graph is given by {4, 4, 2}.

Article Tags :