Binary relations as the topological closure of the diagonal If $(X,\tau)$ is a topological space, we can consider the product topology on $X\times X$ and take the closure of the diagonal $\Delta_X = \{(x,x): x\in X\}$, which we denote by $\mathrm{cl}(\Delta_X)$. Obviously, $\mathrm{cl}(\Delta_X)$ is a symmetric binary relation.
Now we can take things upside down: Let $X$ be a set and let $R\subseteq X\times X$ be a reflexive and symmetric relation. Is there a topology $\tau$ on $X$ such that $\mathrm{cl}(\Delta_X)=R$?
 A: The answer is no, not necessarily. For a counterexample, let $X=\mathbb{R}$ and let $aRb\iff a=b \text{ or } |a-b|\geq 1$, the "equal or differ by at least one" relation. This is symmetric and reflexive. Suppose $\tau$ is a topology on $\mathbb{R}$ with $\text{cl}(\Delta)=R$. For any real number $k$, the $k^{\rm th}$ slice in the plane leads to $(k-1,k)\cup(k,k+1)$ being open with respect to $\tau$. By taking intersections of such sets, we get tiny open intervals $(a,b)$ being open, and this violates $\text{cl}(\Delta)=R$. 
A: Let $\ |X|\ge 4,\ $ e.g. $\ X := \mathbb Z/4.\ $ Let $\ j : X\rightarrow X\ $ be an involution without any fixed point, i.e. $\ (j\circ j)(x) = x \ne j(x)\ $ for every $\ x\in X;\ $ e.g. $\ j(x) = x+2 \mod 4\ $. Let
$$ R\ :=\ \{ (x\ y)\in X^2\ :\ y\ne j(x) \} $$
Then there does not exist a topology $\ T\ $ in $\ X\ $ such that $\ R\ $ is the closure of the diagonal $\ D := \{ (x\ x):\ x\in X\}\ \subseteq X^2$.

PROOF   By a contradiction, let $\ T\ $ be a topology in $\ X\ $ as described above. The functions $\ I_X : X\rightarrow X\ $ and $\ \imath_x : \{x\} \rightarrow X\ $ such $\ I(t):=t\ $ for every $\ t\in X\ $ and $\ \imath_x(x):=x\ $ are continuous. Thus the diagonal product $\ I_X\Delta\imath_x : X\rightarrow X^2\ $ is continuous; and so is the projection $\ \pi_1:X^2\rightarrow X\ $ given by $\ \pi_1(t\ u) := t.\ $ It follows that the canonical bijection

$$\ b_x := \pi_1|X\times\{x\} :\ X\times \{x\} \rightarrow X$$
is a homeomorphism. Thus $\ X\setminus\{\imath(y)\} = \pi_1(R\ \cap\ X\times \{y\}\ $ is closed in $\ X\ $ for each $\ y\in X,\ $ hence $\ \{x\}\ $ is open in $\ X\ $ for $\ y:=j(x);\ $ this means that $\ \{x\} $ is open for every $\ x\in X,\ $ i.e. $\ X\ $ would be Hausdorff. However the closure $\ R\ $ of the diagonal is different from the diagonal--a contradiction. (so much for an intro to Gen. Top.; sorry to be boring).
A: According to this article of Colasante and Van Der Zypen, it is an open problem to characterize those reflexive and symmetric relations for which there is such a topology. If we restrict ourselves to $T_2$ topologies then we all know that only the identity relation admitts one. In the paper I just mentioned, Colasnate and Van Der Zypen show that an equivalence relation on an infinite $X$ admits a $T_1$ topology if and only if it has infinitely many equivalence classes or every finite equivalence class is a singleton.
