Program to find total number of edges in a Complete Graph | Java implementation to find the number of edges in a complete graph ; Function to find the total number of edges in a complete graph with N vertices ; Driver Code
class GFG { static int totEdge ( int n ) { int result = 0 ; result = ( n * ( n - 1 ) ) / 2 ; return result ; } public static void main ( String [ ] args ) { int n = 6 ; System . out . println ( totEdge ( n ) ) ; } }