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.
Attention reader! All those who say programming isn't for kids, just haven't met the right mentors yet. Join the Demo Class for First Step to Coding Course, specifically designed for students of class 8 to 12.
The students will get to learn more about the world of programming in these free classes which will definitely help them in making a wise career choice in the future.
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