I am studying Rudin's Real and Complex Analysis exercises and I am currently thinking about the following:
Is there a characterization of the class of compact sets of $\mathbb{R}$ which are supports of continuous functions? Is this characterization valid in other topological spaces?
For the first question, I have come to a seemingly necessary and sufficient condition on $K$, which may be a bit too complicated : $K$ is the support of a continuous function iff for all $x\in K$, for all neighborhood $V$ of $x$, there exists a nonempty open set $U\subset K\cap V$. The fact that it is necessary is pretty obvious, and for the sufficient aspect, I have considered the connected components of such a $K$, which are segments. I call a ''trivial segment'' a segment which is a singleton. Putting aside the trivial case where $K$ is empty, there is at least one nontrivial segment among the connected components of $K$. The following two cases can arise:
If the number of nontrivial connected components is finite, there is no trivial segment and $f$ can be defined as a triangle-shape function on all the connected components and $0$ otherwise. $f$ is continuous and has support $K$.
If the number of nontrivial connected components is infinite, it is countable and the nontrivial components can be ordered as $\{C_n\}_{n>0}$. On each $C_n$ $f$ is defined as a triangle-shape function of height $1/n$, and $0$ outside of $\cup_{n>0}C_n$. Again, $f$ is continuous and has support $K$.
I am now considering the extension to other spaces and I can't really figure out a way to generalize the result. The necessary condition on $K$ seems to remain valid on a general topological space, but for the other part of the proof, I have used the particular nature of the connected sets of $\mathbb{R}$, which cannot be used in the general case. Is there a way to claim a more general result, maybe involving a simpler characterization?