If $f$ is continuous, then $G$ is connected . True/false?

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.

• you should at least assume that $X$ is connected. May 26 '19 at 7:24
• @Thomas compact implies connected here already given that X be a compact topological space May 26 '19 at 7:25
• nonsense: a finite metric space is compact but not connected. The Cantor set too. Or $[0,1] \cup \{2\}$ etc.. May 26 '19 at 7:26
• @jasmine Compact most definitely does not imply connected, not even by a long shot. May 26 '19 at 7:26
• @HennoBrandsma sir u r right i forget the example May 26 '19 at 7:27

False, and compactness is a red herring. We need $$X$$ to be connected.
It's clear that $$G$$ is homeomorhic to $$X$$ when $$f$$ is continuous (the first projection is the continuous inverse and when $$f$$ is continuous, so is the map $$F: x \to (x, f(x))$$ and $$G=F[X]$$).
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.