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:
- Ways to Remove Edges from a Complete Graph to make Odd Edges
- Program to find the diameter, cycles and edges of a Wheel Graph
- Maximum number of edges that N-vertex graph can have such that graph is Triangle free | Mantel's Theorem
- Maximum number of edges in Bipartite graph
- Minimum number of edges between two vertices of a Graph
- Number of Simple Graph with N Vertices and M Edges
- Count number of edges in an undirected graph
- Minimum number of edges between two vertices of a graph using DFS
- 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
- Program to find the number of region in Planar Graph
- Total number of Spanning trees in a Cycle Graph
- Total number of days taken to complete the task if after certain days one person leaves
- Program to find the time remaining for the day to complete
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.