Why can a simple undirected graph with $n$ vertices have at most $n(n-1)/2$ edges?
Without self-loops and parallel edges a vertex can be joined to each of the other $n - 1$ vertices at most once, so its degree is at most $n - 1$. Then $2m = \sum_v \deg(v) \le n(n-1)$, so $m \le n(n-1)/2$. The complete graph, where every pair of vertices is joined, reaches the bound: 4 vertices, 6 edges.
* Every vertex is joined to all the others: degree 3 with 4 vertices, degree 4 with 5. *
$n(n-1)/2$ is simply the number of different pairs among $n$ vertices, "n choose 2", and a simple graph can use each pair at most once. Counted another way: the first vertex can get edges to the $n - 1$ others, the second to $n - 2$ new ones, and so on down to 1, and $(n-1) + (n-2) + \ldots + 1 = n(n-1)/2$, the same sum that counts the comparisons of selection-sort. A simple directed graph can use each ordered pair once, so it has at most $n(n-1)$ edges.
The bound is why $m$ is $O(n^2)$, and therefore $\log m$ is $O(\log n)$: in running times, $O(\log m)$ and $O(\log n)$ are the same class. With 10 000 vertices a simple graph has at most 49 995 000 edges. Most real graphs stay far below that maximum, which is what decides how to store them.
Go deeper:
Complete graph โ the graphs that reach the bound, with their properties and drawings.