We show that a graph admits a topology on its node set which is compatible with the usual connectivity of undirected graphs if, and only if, it is a comparability graph. Then, we give a similar condition for the weak connectivity of oriented graphs and show there is no topology which is compatible with the strong connectivity of oriented graphs. We also give a necessary and sufficient condition for a topology on a discrete set to be 'representable' by an undirected graph.