Wheel Graph: A Wheel graph is a graph formed by connecting a single universal vertex to all vertices of a cycle. Properties:-
- Wheel graphs are Planar graphs.
- There is always a Hamiltonian cycle in the Wheel graph.
- Chromatic Number is 3 and 4, if n is odd and even respectively.
Problem Statement: Given the Number of Vertices in a Wheel Graph. The task is to find:
- The Number of Cycles in the Wheel Graph.
- Number of edges in Wheel Graph.
- The diameter of a Wheel Graph.
- Program to find total number of edges in a Complete Graph
- Ways to Remove Edges from a Complete Graph to make Odd Edges
- Print all the cycles in an undirected graph
- Cycles of length n in an undirected and connected graph
- Product of lengths of all cycles in an undirected graph
- Minimum number of edges between two vertices of a Graph
- Count number of edges in an undirected graph
- Maximum number of edges in Bipartite graph
- Minimum number of edges between two vertices of a graph using DFS
- Number of Simple Graph with N Vertices and M Edges
- All vertex pairs connected with exactly k edges in a graph
- Shortest path with exactly k edges in a directed and weighted graph
- Largest subset of Graph vertices with edges of 2 or more colors
- Tree, Back, Edge and Cross Edges in DFS of Graph
- Maximum number of edges among all connected components of an undirected graph
Input: vertices = 4 Output: Number of cycle = 7 Number of edge = 6 Diameter = 1 Input: vertices = 6 Output: Number of cycle = 21 Number of edge = 10 Diameter = 2
Example #1: For vertices = 4 Wheel Graph, total cycle is 7:
Example #2: For vertices = 5 and 7 Wheel Graph Number of edges = 8 and 12 respectively:
Example #3:For vertices = 4, the Diameter is 1 as We can go from any vertices to any vertices by covering only 1 edge.
Formula to calculate the cycles, edges and diameter:-
Number of Cycle = (vertices * vertices) - (3 * vertices) + 3 Number of edge = 2 * (vertices - 1) Diameter = if vertices = 4, Diameter = 1 if vertices > 4, Diameter = 2
Below is the required implementation:
Number of Cycle = 7 Number of Edges = 6 Diameter = 1
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.