![]() |
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 the shortest/minimum path in a graph that covers all the vertices of a graph. Examples: Input: Vertices = 3 Output: Total Spanning tree = 3 Input: Vertices = 4 Output: Total Spanning tree = 4 Example 1: For Cycle Graph with vertices = 3 Spanning Tree possible is 3 Example 2: Spanning Tree possible is 4 So, the number of spanning trees will always be equal to the number of vertices in a cycle graph. Implementation: C++
Javascript
Output
Spanning tree = 4 Time Complexity: O(1) |
Reffered: https://www.geeksforgeeks.org
Graph |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 8 |