[Math] Is a function $f:X\to Y$ continuous if and only if its graph on each connnected component of $X$ is connected

connectednesscontinuitygeneral-topology

I was thinking about this question today. Is the following true:

Let $X$ be a topological space with connected components $\{C_i\}_{i\in I}$. Let $Y$ be a topological space and let $f:X\rightarrow Y$ be a function. Then $f$ is continuous iff $$\forall i\in I, \;\{(x,f(x))\mid x\in C_i\}\text{ is a connected subspace of }X\times Y$$

The forward direction is easy, as $\{(x,f(x))\mid x\in C_i\}$ is the continuous image of the connected subspace $C_i$ (the mapping would send $x$ to $(x,f(x))$).

I am not sure if the backward direction is true for all topological spaces.

Thank you

Best Answer

I think you would need the condition of (local?) path connectivity for this to be true. Consider as a counterexample the topologist's sine curve, i.e. $f:[0,1]\to[-1,1]$ given by $$ f(x)= \begin{cases} \sin\left(\frac1x\right)&x>0\\ 0&x=0 \end{cases} $$ The space $(x,f(x))$ is connected, but $f(x)$ is not continuous at $x=0$.