Here is Prob. 6, Chap. 4 in the book Principles of Mathematical Analysis by Walter Rudin, 3rd edition:
If $f$ is defined on $E$, the graph of $f$ is the set of points $\left( x, f(x) \right)$, for $x \in E$. In particular, if $E$ is a set of real numbers, and $f$ is real-valued, the graph of $f$ is a subset of the plane.
Suppose $E$ is compact, and prove that $f$ is continuous on $E$ if and only if its graph is compact.
We can reformulate the above problem as follows:
Suppose $\left( X, d_X \right)$ and $\left( Y, d_Y \right)$ are metric spaces, $E$ is a compact set in the metric space $\left( X, d_X \right)$, and $f$ is a mapping of $E$ into $Y$. Then the graph of $f$ is a subset of $X \times Y$, and even of $E \times Y$ or $E \times f(E)$. Right? Now the conclusion is that $f$ is continuous if and only if the graph of $f$ is compact.
Is this reformulation correct?
If so, then with respect to what metric are we talking about the compactness of the graph? And, how to prove the result?
There is one more thing that I would like to add.
Can we just use the material covered up to this point in Baby Rudin to answer the question I've posed and to give the required proof?