what is the maximum number of edges in a graph with self-loop? If we have a graph G with n nodes, what is the maximum number of edges in this graph if we allow self-loop, is it n^2 and why, please look at the graph bellow:
N=4, is maximum number of edges=16 or 10 I found it is 10 ?

 A: If there are no loops it is $\binom{n}{2}$, there are at most $n$ loops so the new maximum is $\binom{n}{2}+n=\binom{n+1}{2}$
A: From your diagram 


*

*every vertex is degree $n+1$

*there are $n$ vertices

*each edge has two ends (so contributes twice to degree counts), 


so the resulting edge count is
$$\frac  12 n(n+1)$$

Added, following discussion in comments
The $n+1$ degree for each vertex arises from every vertex attaching to every other vertex ($n-1$ connections), and having a self-loop, which counts $2$ more in degree, for total degree of $n+1$.
The loop increases count by $2$ because to assess degree, you just count "how many wires are sticking out of the junction". Each edge has two ends, one end connects to one vertex, the other end connects to another vertex, and that edge  is counted for degree at both ends. Even if the vertex at each end of the edge is the same vertex, it's still counted twice. As with the "wires at the junction" analogy - it's about how many connections there are at the vertex.
And of course it works in the given case. $\frac 12\times 4\times 5 = 10$.
A: 1st node can linked with [n] nodes(include self).
2nd node can linked with [n-1] nodes(include self, exclude above).
3nd node can linked with [n-2] nodes(include self, exclude above).
4th node can linked with [n-3] nodes(include self, exclude above).
.
.
.
.
nth node can linked with [1] nodes(only self).


 
So, all edeges is 
$$
 n + (n-1) + (n-2) + (n-3) + .... + 3 + 2 + 1 = \frac{n(n+1)} {2}
$$
A: Undirected is $N^2$. 
Simple - every node has N options of edges (himself included), total of N nodes thus $N\cdot N !$ so $m=n \cdot n$
