I had to examine the closed graph theorem under the following circumstances:
$X, Y$ metric spaces with $Y$ compact. Does the theorem also hold if Y is not compact?
(Assuming compactness in the context of metric spaces means complete and bounded. → link)
I have an idea of how to proceed (draft below), but I cannot visualize—and hence incorporate into the proof—why $Y$ would need to be compact, but not $X$.
For example, $f:\mathbb R \to \mathbb R, x \mapsto x$, is continuous, while $\mathbb R$ is not compact. What am I missing?
$(\Rightarrow)$ by contradiction:
Assume $f$ is continuous, but $G(f)$ is not closed. Then $$\exists (x_n,y_n)_n\in G(f): \lim_{n \to \infty} (x_n, y_n)\not\in G(f).$$ But since the graph only consists of tuples where $y_n = f(x_n)$ and $f$ is continuous that leads to a contradiction.
$(\Leftarrow)$ worked out in a similar fashion: If there is a sequence $x_n \in X$ with limit $c \in X$ such that the limit of $f(x_n)\not = f(c)$, then the graph would have at least one point—$(c,f(c))$—afflickting the graph's closedness.