Why a complete graph has n(n−1)2\frac{n(n-1)}{2} edges?

I’m studying graphs in algorithm and complexity,
(but I’m not very good at math) as in title:

Why a complete graph has n(n1)2 edges?

And how this is related with combinatorics?


A simpler answer without binomials: A complete graph means that every vertex is connected with every other vertex. If you take one vertex of your graph, you therefore have n1 outgoing edges from that particular vertex.

Now, you have n vertices in total, so you might be tempted to say that there are n(n1) edges in total, n1 for every vertex in your graph. But this method counts every edge twice, because every edge going out from one vertex is an edge going into another vertex. Hence, you have to divide your result by 2. This leaves you with n(n1)/2.

Source : Link , Question Author : nkint , Answer Author : Lagerbaer

Leave a Comment