$f$ is continuous on $E$ if and only if its graph is compact. This question may be asked before under different formulation, the original problem is Chapter 4, Exercise 7 of Rudin's text: The Principles of Mathematical Analysis:
Problem:
If $f$ is defined on $E$, the graph is the set of points $(x, f(x))$, for $x \in E$. 
Suppose $E$ is compact, and prove that $f$ is continuous on $E$ if and only if its graph is compact. 
My Attempt: Let $\Gamma(f) = \{(x, f(x)): x \in E\} \subset E \times \mathbb{R}^1$. I was trying to define a function $F: E \rightarrow E \times \mathbb{R}^1$ by $F(x) = (x, f(x))$ and show $F$ is continuous on $E$. Since $E$ is compact, it follows that $F(E) = \Gamma(f)$ is compact.
For the converse, the earlier thread 
A real function on a compact set is continuous if and only if its graph is compact stated that the projection function $\pi$ is continuous on $E \times \mathbb{R}^1$.
My question is: without knowing any specific metric on $E$ or on $E \times \mathbb{R}^1$, it looks hard to me to show that $F$ and $\pi$ aforementioned are continuous. Since the condition doesn't give any information about what I concern, how should I proceed?
 A: Suppose that $f$ is continuous, and define $F(x):=(x,f(x))\subset E\times\mathbb R$. Fix $x\in E$ and consider a sequence $(x_n)\subset E$ converging to $x$. Since $f$ is continuous, $f(x_n)\to f(x)$ and hence $F(x_n)=(x_n,f(x_n))\to(x,f(x))=F(x)$, which shows that $F$ is continuous. Now your argument works fine, since now $\Gamma(f)=F(E)$ is compact.
For the converse assume that $\Gamma(f)=F(E)$ is compact. Fix $x\in E$ and a sequence $(x_n)\subset E$ converging to $x$. Assume that $(x_n,f(x_n))$ does not converge to $(x,f(x))$. Since $\Gamma(f)$ is compact, there is a subsequence $(x_{n_k},f(x_{n_k})$ that converges in $\Gamma(f)$ to some $(x',y)\neq(x,f(x))$. But since $(x_n)$ converges to $x$, then so does $(x_{n_k})$ (because it's a subsequence), which implies $x'=x$. But since $(x',y)\in\Gamma(f)$, we must have $y=f(x')=f(x)$ and consequently $(x',y)=(x,f(x))$, a contradiction. This shows that $(x_n,f(x_n))\to(x,f(x))$; in particular, $f(x_n)\to f(x)$, which proves that $f$ is continuous at $x$ (and that $F$ is continuous at $x$ as well).
