Total number of Spanning trees in a Cycle Graph
Given the number of vertices in a Cycle graph. The task is to find the Total number of Spanning trees possible.
Note: A cycle/circular graph is a graph that contains only one cycle. A spanning tree is a shortest/minimum path in a graph that covers all the vertices of a graph.
Hey! Looking for some great resources suitable for young ones? You've come to the right place. Check out our self-paced courses designed for students of grades I-XII.
Start with topics like Python, HTML, ML, and learn to make some games and apps all with the help of our expertly designed content! So students worry no more, because GeeksforGeeks School is now here!
Input: Vertices = 3 Output: Total Spanning tree = 3 Input: Vertices = 4 Output: Total Spanning tree = 4
For Cycle Graph with vertices = 3
Spanning Tree possible is 3
For Cycle Graph with vertices = 4
Spanning Tree possible is 4
So, the number of spanning treess will always be equal to the number of vertices in a cycle graph.
Below is the required implementation:
Spanning tree = 4