TITLE: Graph of a function homeomorphic to a space implies continuity of the map?
QUESTION [11 upvotes]: If $X,Y$ are topological spaces and $f: X \rightarrow Y$ is a continuous map then it can be shown that the graph of $f$, $G_{f}$, is homeomorphic to $X$. But is the converse true? That is: if $G_{f} \cong X$ via the map $(x,f(x)) \mapsto x$ is $f$ necessarily a continuous map? I suspect no but haven't had luck with a counterexample. Is this true/false?

REPLY [4 votes]: Let $\hat f:X \to G_f:x \mapsto \langle x,f(x) \rangle$, and assume that $\hat f$ is a homeomorphism. Note that $\hat f^{-1}$ is simply the restriction $p$ of the projection $\pi_X:X \times Y \to X$ to $G_f$, so $p$ is also a homeomorphism. Let $V$ be any open set in $Y$, and let $W = (X \times V) \cap G_f$; $W$ is open in $G_f$, so $p[W]$ is open in $X$. But $p[W] = \hat f^{-1}[W] = f^{-1}[V]$, so $f$ is continuous.
Added: If we do not require that $\hat f$ be the homeomorphism from $X$ to $G_f$, we cannot conclude that $f$ is continuous. Let $X = Y = \mathbb Q$, and enumerate $\mathbb Q = \{q_n:n \in \omega\}$. Let $\mathcal I$ be the set of non-empty open intervals $(p,r)$ in $\mathbb Q$, and enumerate $\mathcal I \times \mathcal I = \{\langle I_0(n),I_1(n) \rangle:n \in \omega \}$. We now recursively construct a function $f:\mathbb Q \to \mathbb Q$ as follows:

At stage $n$ let $m \in \omega$ be minimal s.t. $q_m \in I_0(n)$, and let $f(q_m)$ be any rational number in $I_1(n)$.

To see that $f(q)$ is defined for every $q \in \mathbb Q$, suppose not, and let $m \in \omega$ be minimal s.t. $f(q_m)$ is not defined. Each non-empty rational interval $(p,r)$ occurs as $I_0(n)$ for infinitely many $n \in \omega$, so there are infinitely many $n$ s.t. $q_m \in I_0(n)$. In particular, there is a least $n \in \omega$ s.t. $q_m \in I_0(n)$ and all $f(q_k)$ for $k<m$ have been defined by stage $n$, and at this point the construction defines $f(q_m)$.
The construction of $f$ clearly ensures that the point $\langle q_m,f(q_m) \rangle$ chosen at stage $n$ is in $I_0(n) \times I_1(n)$, so $G_f$ is dense in $\mathbb Q \times \mathbb Q$. Thus, $G_f$ is a countable, metrizable space without isolated points and as such is homeomorphic to $\mathbb Q$ with the usual topology, i.e., to $\text{dom }f$. It's also clear that $f$ cannot be continuous, since by construction $\{q \in \mathbb Q:f(q) \in (0,1)\}$ and $\{q \in \mathbb Q:f(q) \in (2,3)\}$ are both dense in $\mathbb Q$.