Suppose $f: E \to N$ where $E$ is compact. The graph of $f$ is: $$ G(f)=\{(x,f(x)):x\in E\} $$ Also, assume that $G$ is compact.
Consider $(x_n) \subseteq E, (x_n)\to x$ and the corresponding sequence $(x_n,f(x_n)) \subseteq G$. Since $G$ is compact, pick a subsequence: $$ (x_{n_k},f(x_{n_k})) \to (x,a) $$
Question: Is $a=f(x)$?
Since $(x,a)\in G(f)$ you have, by definition of graph, that $f(x)=a$.