Let $X$ be a compact topological space and let $f : X \rightarrow \mathbb{R}$ be a function . The graph $f$ is the set $G = \{ (x, f(x) ) : x \in X \} \subseteq X \times \mathbb{R}$
My question is that Is the following statement is True/false ?
If $f$ is continuous, then $G$ is connected
My attempt : I think yes, because the continuous image of a connected set is connected.
In general, it is false. If, for instance, $X=\{0,1\}$, endowed with the discrete topology, then $X$ is compact, but $G$ is always disconnected.
Of course, the statement holds if $X$ is connected, even without assuming compactness.