Given N number of vertices of a Graph. The task is to find the total number of edges possible in a complete graph of N vertices.
Complete Graph: A Complete Graph is a graph in which every pair of vertices is connected by an edge.
Input : N = 3 Output : Edges = 3 Input : N = 5 Output : Edges = 10
The total number of possible edges in a complete graph of N vertices can be given as,
Total number of edges in a complete graph of N vertices = ( n * ( n – 1 ) ) / 2
Example 1: Below is a complete graph with N = 5 vertices.
The total number of edges in the above complete graph = 10 = (5)*(5-1)/2.
Below is the implementation of the above idea:
- Program to find the diameter, cycles and edges of a Wheel Graph
- Count number of edges in an undirected graph
- Minimum number of edges between two vertices of a Graph
- Maximum number of edges among all connected components of an undirected graph
- Maximum number of edges to be added to a tree so that it stays a Bipartite graph
- Total number of Spanning Trees in a Graph
- Total number of Spanning trees in a Cycle Graph
- All vertex pairs connected with exactly k edges in a 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
- Tree, Back, Edge and Cross Edges in DFS of Graph
- Assign directions to edges so that the directed graph remains acyclic
- Maximum Possible Edge Disjoint Spanning Tree From a Complete Graph
- Find the total Number of Digits in (N!)N
- Program to find Circuit Rank of an Undirected Graph
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.