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
- Maximum number of edges that N-vertex graph can have such that graph is Triangle free | Mantel's Theorem
- Count of all cycles without any inner cycle in a given Graph
- Print all the cycles in an undirected graph
- Product of lengths of all cycles in an undirected graph
- Cycles of length n in an undirected and connected graph
- Number of Simple Graph with N Vertices and M Edges
- Path with minimum XOR sum of edges in a directed graph
- Maximum number of edges in Bipartite graph
- Count number of edges in an undirected graph
- All vertex pairs connected with exactly k edges in a graph
- Minimum number of edges between two vertices of a Graph
- Minimum number of edges between two vertices of a graph using DFS
- Tree, Back, Edge and Cross Edges in DFS of Graph
- Largest subset of Graph vertices with edges of 2 or more colors
- Shortest path with exactly k edges in a directed and weighted graph | Set 2
- Shortest path with exactly k edges in a directed and weighted graph
- Minimum number of Edges to be added to a Graph to satisfy the given condition
- Assign directions to edges so that the directed graph remains acyclic
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
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
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.