-1
$\begingroup$

Hello I don't understand how this works. I thought a graph with n edges has n(n-1)/2 vertices. Also when I put in numbers for m I get a fraction answer. Does that mean that m is fraction to begin with but that doesn't make sense since m is the number of edges. Please help

2 Answers 2

2

I think you misread the formula.

Suppose there are $n$ vertices.

Then each vertex is connected to $n-1$ vertices for a total of $n(n-1)$ edges.

However, since this counts each edge twice, the total number of edges is $\frac12n(n-1)$.

If there are $m$ edges, then $m =\frac12n(n-1) $, so $n(n-1)=2m$ or $n^2-n-2m = 0$.

Solving this quadratic equation, $n =\dfrac{1\pm\sqrt{1+8m}}{2} $.

Since $n > 0$, we must have $n =\dfrac{1+\sqrt{1+8m}}{2} $.

And this, I think, is the formula you meant.

  • 0
    This makes a lot more sense. Thanks for your help!2017-02-03
0

A complete graph with $n$ vertices has $\frac{n(n-1)}{2}$ edges only if it undirected. Otherwise, it has $n(n-1)$ edges.