Show that G has a cycle if $|E| \geq |V|$ Show that if $G=(V, E)$ is a simple graph such that $|E| \geq |V|$ then graph has a cycle.
I'm having problems with understanding what my professor said about this problem. I know that there is this question answered (here) but it's done another way. My professor gave a very general idea about this proof - he said something about connected components and that from the pigeonhole principle we can deduce that at least in one component there are at least as many edges as vertices and there we can search for a cycle. I'm specifically confused about the pigeonhole principle so I would appreciate some help with understanding this.
 A: If it is somehow easier to prove "if $G$ is connected and $|E| \ge |V|$, then $G$ has a cycle", then we can reduce to that case using the pigeonhole principle.
Suppose that $G$ has $n$ vertices and $k$ connected components, with $n_i$ vertices in the $i^{\text{th}}$ connected component (so that $n_1 + n_2 + \dots + n_k = n$). We assume that $G$ has at least $n$ edges.
From this, we want to prove that for at least one value of $i$, the $i^{\text{th}}$ connected component has at least $n_i$ edges. This is in spirit similar to the pigeonhole principle, but you can also just think of it as a proof by contradiction. If this is not true, then the $i^{\text{th}}$ connected component has at most $n_i - 1$ edges for every $i$. Then the total number of edges is at most $$(n_i - 1) + (n_2 - 1) + \dots + (n_k - 1) = (n_1 + \dots + n_k) - k = n-k$$ which is less than $n$; this contradicts our initial assumption that $G$ has at least $n$ edges.
From here, we might finish up by saying that a connected component with $n_i$ vertices and at least $n_i$ edges cannot be a tree (because the tree would only have $n_i - 1$ edges) so it must contain a cycle (because all connected and acyclic graphs are trees). Or something. The punchline probably depends on what sort of tools you've already built up about connected graphs.
