On Robust Colorings of Hamming-Distance Graphs

Abstract: $H_q(n,d)$ is defined as the graph with vertex set ${\mathbb Z}_q^n$ and where two vertices are adjacent if their Hamming distance is at least $d$. The chromatic number of these graphs is presented for various sets of parameters $(q,n,d)$. For the $4$-colorings of the graphs $H_2(n,n-1)$ a notion of robustness is introduced. It is based on the tolerance of swapping colors along an edge without destroying properness of the coloring. An explicit description of the maximally robust $4$-colorings of $H_2(n,n-1)$ is presented.

\section{Introduction}
In this paper we study vertex colorings of graphs based on the Hamming distance.
Precisely, fix $q\geq2$ and $d\leq n$ and consider the graph with vertex set ${\mathbb Z}_q^n$ and
where two vertices are adjacent if their Hamming distance is at least~$d$.
We denote these graphs by $H_q(n,d)$ and call them Hamming-distance graphs or shortly Hamming graph
(the latter terminology, however, is used for a variety of graphs in the literature and therefore needs to be taken with care).
Note that the cliques in $H_q(n,d)$ are exactly the $q$-ary block codes of length~$n$ and Hamming distance at least~$d$, whereas the
independent sets are the anticodes with maximum distance $d-1$.

For general parameters, $H_q(n,d)$ is not a graph product of any standard sort (weak, strong, cartesian etc.) and therefore the
abundant literature on the chromatic number and colorings of graph products (see, e.g., the survey~\cite{Kl96} by Klav\u{z}ar
and the references therein) does not apply.

However, for $d=n$ the graph $H_q(n,n)$ is the $n$-th weak power of the complete graph~$K_q$ on~$q$ vertices, and its
chromatic number as well as all minimal colorings are known.
Precisely, the chromatic number of this graph is~$q$ and (for $q>2$) each $q$-coloring is given by a
coordinate coloring, that is, by simply assigning the value of a fixed coordinate as the color; see~\cite{GrLo74} by Greenwell/Lov\'{a}sz
as well as~\cite{ADFS04} by Alon et al., where -- among many other results -- the authors present an alternative
proof based on Fourier analytical methods.
By applying a certain relation between a function and its Fourier transform to the indicator function of a maximal
independent set they derive the exact structure of that set.

We will begin with discussing the chromatic number of $H_q(n,d)$.
This discussion is closely related to~\cite{RGSS07} by Rouayheb et al., where the authors link bounds on codes to properties
of the Hamming graphs.
In~\cite{JaMa06}, Jamison/Matthews study the chromatic number of the graph complement of $H_q(n,d)$ for various sets of parameters.
However, their results combined with the well-known Nordhaus-Gaddum relations between the chromatic numbers of a graph and its complement do
not lead to any tighter bounds than those presented in this paper.

As for the chromatic number, it is straightforward to generalize the idea of coordinate colorings
of $H_q(n,n)$ in~\cite{ADFS04} to $H_q(n,d)$.
This trivially leads to the upper bound $q^{n-d+1}$ for the chromatic number of $H_q(n,d)$.
As a consequence, the chromatic number of $H_2(n,n-1)$ is~$4$ because Payan~\cite{Pa92} showed that the chromatic number
of a nonbipartite cube-like graph is at least~$4$.
Furthermore, with the aid of the Erd\H{o}s-Ko-Rado Theorem for integer sequences~\cite{AhKh98,FrTo99,Kl66} it can be shown that
for various other sets of parameters,
$q^{n-d+1}$ is in fact the chromatic number; see Corollary~\ref{C-ConjCases} for details.
The general case, however, remains open (to the best of our knowledge).
This includes $H_2(n,d)$ for most pairs $(n,d)$ with $d<n-1$.

In the main part of the paper we will focus on the graphs $H_2(n,n-1)$, which have chromatic number~$4$.
We show that -- different from $H_q(n,n)$ -- these graphs enjoy $4$-colorings that are not coordinate colorings.
Even more, they also allow uneven $4$-colorings (i.e., the color classes do not have the same size).
This irregular structure of maximal independent sets and minimal colorings suggests that the Fourier analytical methods of~\cite{ADFS04}
are unlikely to be of any help in order to determine the exact chromatic number for general $H_q(n,d)$.

The abundance of genuinely different $4$-colorings of $H_2(n,n-1)$ gives rise to the question of whether the colorings can be ranked in a certain way.
We approach this question by introducing a measure of robustness, which  is based on
the number of transition edges.
We call an edge a transition edge of a given coloring if swapping the colors of the two incident vertices leads to a new proper coloring.
The robustness is simply the fraction of transition edges among all edges.
We show that if~$n$ is odd the coordinate colorings are exactly the maximally robust $4$-colorings of $H_2(n,n-1)$, while for even~$n$
there is an additional (natural) type of coloring with maximal robustness.
Furthermore, we show that a $4$-coloring is maximally robust if and only if the transition edges tile the graph in disjoint $4$-cycles.

Throughout the paper we use the following terminology and notation.
For any graph~$G$ we denote by $V(G)$ its vertex set and by $E(G)$ its edge set.
Thus $E(G)\subseteq V(G)\times V(G)$.
All graphs have neither loops nor multiple edges.
Furthermore, graphs are undirected, and thus
$(x,y)\in E(G)\Longleftrightarrow (y,x)\in E(G)$.
We also use the notation $\sim$ for adjacency, thus $x\sim y\Longleftrightarrow (x,y)\in E(G)$.
Let ${\mathcal N}(x):=\{y\in V(G)\mid y\sim x\}$ denote the set of neighbors of vertex $x\in V(G)$.
For any graph~$G$ we define the following invariants:
$\alpha(G)$ denotes its independence number, that is, the maximal size of an independent set;
$\omega(G)$ is the clique number, that is, the maximal size of a clique in~$G$;
$\mbox{\rm girth}(G)$ denotes the girth, that is, the length of a shortest cycle.
A proper $k$-coloring is a vertex coloring such that adjacent vertices have different colors.
We only consider proper colorings and usually omit the qualifier `proper' unless we explicitly discuss properness.
We denote by~$\chi(G)$ the chromatic number, that is, the minimal~$k$ such that~$G$ has a proper $k$-coloring.
Any $\chi(G)$-coloring is called a \emph{minimal coloring}.
A coloring is called \emph{even} if all color classes (the sets of vertices with the same color) have the same cardinality.
Finally, for any $x,\,y\in V(G)$ we define $\mbox{\rm d}_G(x,y)$ as the graph distance between~$x$ and~$y$, that is, the length of a
shortest path from~$x$ to~$y$.
The vector with all entries equal to~$1$ is denoted by~${\mathbbold{1}}$.
Its length will be clear from the context.
We set $[n]:=\{1,\ldots,n\}$.

\section{Basic Properties of the Hamming-Distance Graphs}
Let~$q,\,n\in{\mathbb N}_{\geq2}$ and let~$A$ be a set of cardinality~$q$.
For any two vectors $x,y$ in $A^n$ we denote by $\mbox{\rm d}(x,y):=|\{i\mid x_i\neq y_i\}|$ the Hamming distance between~$x$ and~$y$ and
by $\mbox{\rm wt}(x):=\mbox{\rm d}(x,0)$ the Hamming weight of~$x$.
Recall that a \emph{$q$-ary block code} of length~$n$ and Hamming distance~$d$ over the alphabet~$A$ is a subset, say~${\mathcal C}$, of~$A^n$
such that $\mbox{\rm d}(x,y)\geq d$ for all distinct elements $x,y\in{\mathcal C}$.
The block code is called \emph{linear} if~$A$ is a field of size~$q$ (thus~$q$ is a prime power) and ${\mathcal C}$ is a subspace of the vector space~$A^n$.

Throughout this paper we choose $A={\mathbb Z}_q:={\mathbb Z}/q{\mathbb Z}$.
This is solely for convenience and any alphabet of cardinality~$q$ would work.
However, some arguments are simplified by using the group structure of~${\mathbb Z}_q$, i.e., computing modulo~$q$.
In the very few cases where we consider linearity we will switch to a field of size~$q$.

From now on we assume $q,d,n\in{\mathbb N}$ such that
\begin{equation}\label{e-qnd}
   q,\,n\geq2,\quad 0<d\leq n,\quad (q,d)\neq(2,n).
\end{equation}

The following graph has been introduced and briefly discussed by Sloane~\cite{Sl89} and Rouayheb et al.~\cite{RGSS07}.

\begin{defi}\label{D-Ham}
Let $q,\,d,\,n\in{\mathbb N}$  be as in~\eqref{e-qnd}.
The \emph{Hamming-distance graph}, or simply \emph{Hamming graph}, $H_q(n,d)$ is defined as the graph with vertex set
$V:={\mathbb Z}_q^n$ and edge set $E:=\{(x,y)\mid x,\,y\in{\mathbb Z}_q^n,\,\mbox{\rm d}(x,y)\geq d\}$.
\end{defi}
We point out that in the literature the terminology ``Hamming graph'' sometimes refers to other graphs,
among them for instance our special case~$H_q(n,n)$.
In this paper the name exclusively refers to the graphs in the above definition.

Note that the graph $H_q(n,n)$ is the $n$-th weak power of the complete graph $K_q$ on~$q$ vertices; see also \cite[p.~914]{ADFS04}.

By definition of the Hamming graphs, the cliques form $q$-ary block codes of length~$n$ and Hamming distance
at least~$d$ and thus the clique number $\omega(H_q(n,d))$ is the maximal cardinality of such a code.
On the other hand, the independent sets are the anticodes in~${\mathbb Z}_q^n$ of distance~$d-1$, that is, any two elements in such a set
have distance at most~$d-1$.

Let us briefly look at the case $(q,d)=(2,n)$, which is excluded in~\eqref{e-qnd}.
This case is genuinely different from the general one because
the graph $H_2(n,n)$ is disconnected with $2^{n-1}$ components each one consisting of one edge.
Indeed, every~$x\in{\mathbb Z}_2^n$ has only one neighbor, namely $x+{\mathbbold{1}}$
(recall that $n\geq2$).
Thus $H_2(n,n)$ is entirely uninteresting and excluded from our considerations.

We list some basic properties of the Hamming graphs.
\begin{prop}\label{P-basics}\
\begin{alphalist}
\item $H_q(n,d)$ is regular of degree $\sum_{i=0}^{n-d}{n \choose i}(q-1)^{n-i}$.
\item $H_q(n,d)$ is vertex-transitive.
\item $H_q(n,1)$ is the complete graph on $q^n$ vertices.
\item The Hamming graph $H_q(n,d)$ is the undirected Cayley graph of the group
      $({\mathbb Z}_q^n,+)$ and the subset ${\mathcal S}_d=\{v\in{\mathbb Z}_q^n\mid \mbox{\rm wt}(v)\geq d\}$, which generates the group.
\item $H_q(n,d)$ is connected.
\end{alphalist}
\end{prop}
\begin{proof}
(a) For any vertex~$x\in{\mathbb Z}_q^n$ the neighbors are exactly those vectors that agree with~$x$ in at most~$n-d$ coordinates.
There are clearly ${n \choose i}(q-1)^{n-i}$ vectors that share exactly~$i$ coordinates with~$x$. Summing over all possible~$i$
yields the desired formula.
\\
(b) For any two vertices $x,\,y\in{\mathbb Z}_q^n$ the map ${\mathbb Z}_q^n\longrightarrow {\mathbb Z}_q^n,\ v\longmapsto v+(x-y)$ defines a graph
automorphism that maps~$y$ to~$x$.
\\
(c) is trivial.
\\
(d) Since $(q,d)\neq(2,n)$, the set~${\mathcal S}_d$ indeed generates the group ${\mathbb Z}_q^n$. Even more, the vectors
$(1,1,\ldots,1),(2,1,\ldots,1),(1,2,1\ldots,1),\ldots,(1,\ldots,1,2,1)$ form a basis of the ${\mathbb Z}_q$-module~${\mathbb Z}_q^n$
and are in~${\mathcal S}_d$ for any admissible~$d$.
By the very definition of the Hamming graph, $x,\,y\in{\mathbb Z}_q^n$ are adjacent in $H_q(n,d)$ iff $y=x+v$ for some $v\in{\mathcal S}_d$.
This shows that the graph is the stated Cayley graph.
\\
(e) follows from~(d).
\end{proof}

\begin{prop}\label{P-cycles}
Let $G:=H_q(n,d)$.
\begin{alphalist}
\item Let $q\geq3$. Then $\mbox{\rm d}_G(x,y)\leq 2$ for all $x,y\in V(G)$ and $\mbox{\rm girth}(G)=3$.
\item Let $q=2$ and $d\leq\frac{2n}{3}$. Then $\mbox{\rm girth}(G)=3$.
\item Let $q=2$ and $\frac{2n}{3}<d<n$. Then $\mbox{\rm girth}(G)=4$.
      Moreover,~$G$ contains a cycle of odd length.
\end{alphalist}
\end{prop}
\begin{proof}
(a) Let $x,\,y\in{\mathbb Z}_q^n$ be any distinct vertices. Since $q\geq3$ there exist $z_i\in{\mathbb Z}_q$ such that $x_i\neq z_i\neq y_i$ for all $i=1,\ldots,n$.
Thus $(x,z),\,(z,y)\in E(G)$, and we have a path of length~$2$.
The girth follows from the cycle $0,\,{\mathbbold{1}},\,(2,\ldots,2)$.
\\
(b) Consider the vertices $0,\,x,\,y$, where $x=(1,\ldots,1,0,\ldots,0)$ and $y=(0,\ldots,0,1\ldots,1)$ with both having
exactly~$d$ entries equal to~$1$.
If $n\geq 2d$, then $\mbox{\rm d}(x,y)=2d$ and thus~$0,\,x,\,y$ form a cycle of length~$3$.
Let $n<2d$.
Then~$x$ and~$y$ overlap in exactly $2d-n$ entries (which are equal to~$1$), and therefore $\mbox{\rm d}(x,y)=2n-2d\geq 3d-2d=d$.
Again, the three vertices form a cycle of length~$3$.
\\
(c)
First of all, the vertices $0,\,{\mathbbold{1}},\,(1,0,\ldots,0),\,(0,1,\ldots,1)$ form a cycle of length~$4$ in the Hamming graph.
By vertex-transitivity it now suffices to show that~$0$ is not contained in a cycle of length~$3$.
Suppose $x,y\in{\mathbb Z}_q^n$ are adjacent to~$0$. Then $\mbox{\rm wt}(x),\,\mbox{\rm wt}(y)\geq d$.
Moreover,  $x_i=1=y_i$ for at least $2d-n>\frac{n}{3}$ positions and therefore $\mbox{\rm d}(x,y)<n-\frac{n}{3}=\frac{2n}{3}<d$.
Hence $x,\,y$ are not adjacent, and this shows that the graph has no cycle of length~$3$.
A cycle of odd length is obtained as follows.
For $i=1,\ldots,n$ set $f_i:=(1,\ldots,1,0,1,\ldots,1)$, where~$0$ is at position~$i$.
If~$n$ is odd the vertices $0,f_1,f_1+f_2,\ldots,\sum_{i=1}^n f_i=0$ form a cycle of length~$n$.
If $n$ is even the cycle
$0,\,f_1,\,f_1+f_2,\ldots,\sum_{i=1}^nf_i={\mathbbold{1}},\,0$ has length~$n+1$.
\end{proof}

\section{On the Chromatic Number of the Hamming Graph}\label{S-chi}
There is an obvious way to color any Hamming graph, and it will play a central role in our investigation of  colorings.
\begin{defi}\label{D-CoordCol}
Consider the Hamming graph $H_q(n,d)$.
Fix $1\leq i_1<i_2<\ldots<i_{n-d+1}\leq n$.
The $(i_1,\ldots,i_{n-d+1})$-\emph{coordinate coloring} of $H_q(n,d)$ is defined as
\[
    K:{\mathbb Z}_q^n\longrightarrow {\mathbb Z}_q^{n-d+1},\ (x_1,\ldots,x_n)\longmapsto (x_{i_1},\ldots,x_{i_{n-d+1}}).
\]
It is a proper $q^{n-d+1}$-coloring of $H_q(n,d)$.
\end{defi}
The properness of~$K$ follows from the fact that adjacent vertices have Hamming distance at least~$d$ and therefore
cannot agree on any $n-d+1$ coordinates.
As a consequence,
\begin{equation}\label{e-chi}
  \alpha(H_q(n,d))\geq q^{d-1}\ \text{ and }\ \chi(H_q(n,d))\leq q^{n-d+1}.
\end{equation}

\begin{que}\label{Conj-chi}
Is $\chi(H_q(n,d))= q^{n-d+1}$?
\end{que}

In this section we discuss existing results and several methods to determine the chromatic number explicitly, thereby answering the
question in the affirmative for various sets of parameters.

First of all, we trivially have $\chi(H_q(n,1))=q^n$  because $H_q(n,1)$ is the complete graph on~$q^n$ vertices.
Next, Payan~\cite{Pa92} proved the surprising fact that no nonbipartite cube-like graph can have chromatic number less than~$4$.
Since the binary Hamming graph $H_2(n,d)$ is the cube-like graph $Q_n[d,d+1,\ldots,n]$ we obtain from~\eqref{e-chi}
\begin{theo}\label{T-H2nnm1}
$\chi(H_2(n,n-1))=4$.
\end{theo}

Now we turn to more general cases.
For a proper $r$-coloring of $H_q(n,d)$ the color classes, that is, the set of all vertices with the same color, are independent sets,
and thus the existence of a proper $r$-coloring implies the existence of an independent set of cardinality at least $\lceil{q^n/r}\rceil$.
This leads to the sufficient condition
\begin{equation}\label{e-IndSetChi}
  \alpha(H_q(n,d))<\Big\lceil{\frac{q^n}{q^{n-d+1}-1}}\Big\rceil\Longrightarrow \chi(H_q(n,d))= q^{n-d+1}.

\end{equation}
Furthermore,
\begin{equation}\label{e-EvenCol}
  \alpha(H_q(n,d))=q^{d-1}\ \Longrightarrow\ \text{ each $q^{n-d+1}$-coloring of $H_q(n,d)$ is even.}
\end{equation}
One cannot expect~\eqref{e-IndSetChi} to be very fruitful in determining the chromatic number because it is only a sufficient condition.
In other words, the existence of one independent set with at least $\lceil q^n/(q^{n-d+1}-1)\rceil$ elements does not imply that
$\chi(H_q(n,d))< q^{n-d+1}$ because the latter requires the existence of multiple independent sets
(possibly of varying cardinality).
Yet, some cases can indeed be settled this way as the independence number of the Hamming graph is known for most sets of parameters.
This result is known as the Erd\H{o}s-Ko-Rado Theorem for integer sequences
and has been proven by Kleitman~\cite{Kl66} for the binary case
and Ahlswede/Khachatrian~\cite{AhKh98} as well as Frankl/Tokushige~\cite{FrTo99} for the general case.
In our notation it states the following.

\begin{theo}\label{T-alpha}\
\begin{alphalist}
\item \cite{Kl66} or~\cite[Thm.~K1]{AhKh98} Let $q=2$. Then
      \[
         \alpha(H_2(n,d))=\left\{\begin{array}{cl} {\displaystyle\sum_{i=0}^{\frac{d-1}{2}}{n\choose i}},&\text{ if $d$ is odd,}\\[1.5ex]
                                                   {\displaystyle 2\sum_{i=0}^{\frac{d-2}{2}}{n-1\choose i}},&\text{ if $d$ is even.}
                          \end{array}\right.
      \]
\item \cite[Thm.~2 and pp.~57-58, Cor.~1]{FrTo99} Let $q\geq3$. Set $r:=\lfloor{\frac{n-d}{q-2}}\rfloor$. Then
      \[
        \alpha(H_q(n,d))\leq\Big\lfloor q^{d-1-2r}\sum_{i=0}^r{n-d+1+2r\choose i}(q-1)^i\Big\rfloor,
      \]
      with equality if $d\geq 2r+1$. In particular, $\alpha(H_q(n,d))=q^{d-1}$ for $d\geq n-q+2$ (and $d>0$).
\end{alphalist}
\end{theo}

For $d=n$ the very last part appears also in \cite[Claim 4.1]{ADFS04}.
In Theorem~1.1 of the same paper it is then shown that each maximal independent set of $H_q(n,n)$ (where $q\geq3$) is of the form
${\mathcal I}_{i,\alpha}=\{v\in{\mathbb Z}_q^n\mid v_i=\alpha\}$ for some $i\in[n]$ and $\alpha\in{\mathbb Z}_q$.
This allows one to conclude that each $q$-coloring is a coordinate coloring.
Below we will see that for general $H_q(n,d)$ the maximal independent sets do not have a nice structure.
Moreover, for $d<n$, even if each maximal independent set is the color class of a coordinate coloring, this does not allow one
to conclude that each minimal coloring is a coordinate coloring; see Proposition~\ref{P-qn2} and Example~\ref{E-ColH232}.

For $d<n-q+2$, the upper bound in part~(b) may not be sharp. For instance, for $d=1$ and $n=2q-1$ one obtains
$\lfloor q^{d-1-2r}\sum_{i=0}^r{n-d+1+2r\choose i}(q-1)^i\rfloor=2$, whereas, of course, $\alpha(H_q(n,1))=1$ since $H_q(n,1)$
is the complete graph on $q^n$ vertices.

Now we obtain the following affirmative answers to Question~\ref{Conj-chi}.
It shows that the above method is not very fruitful for the binary case.
Part~(b) below can also be found in \cite[Lem.~18]{RGSS07}.

\begin{cor}\label{C-ConjCases}\
\begin{alphalist}
\item Let $q=2$. Then $\chi(H_2(n,2))=2^{n-1}$ for all $n\in{\mathbb N}_{\geq2}$.
\item Let $q\geq3$. Then $\chi(H_q(n,d))=q^{n-d+1}$ for $d\in\{n-q+2,\ldots,n\}$  (and $d>0$).
      Furthermore, each $q^{n-d+1}$-coloring is even.
\end{alphalist}
\end{cor}

\pagebreak
\begin{proof}
In all given cases one easily verifies the left hand side of~\eqref{e-IndSetChi}.
The last part follows from~\eqref{e-EvenCol}.
\end{proof}

In Example~\ref{E-ColH243} we will see that not all $4$-colorings of $H_2(4,3)$ are even.
An uneven coloring is possible because $\alpha(H_2(4,3))=5>2^{d-1}=4$.
Another uneven $q^{n-d+1}$-coloring is given for $H_3(5,3)$ in Section~\ref{S-OpenProb} showing that the last part of
Corollary~\ref{C-ConjCases}(b) is not true for $d<n-q+2$.

The following case, where $d=2$, is not fully covered by above considerations, but can easily be dealt with in a direct fashion.
\begin{prop}\label{P-qn2}
$\chi(H_q(n,2))=q^{n-1}$ for any~$q$ and each $q^{n-1}$-coloring is even.
\end{prop}
\begin{proof}
We show that each maximal independent set is of the form $\{v+\alpha e_j\mid \alpha\in{\mathbb Z}_q\}$ for some $v\in{\mathbb Z}_q^n$ and some~$j$, and
where~$e_j$ is the $j$-th standard basis vector.
Suppose~$I$ is a maximal independent set containing the two distinct vertices $v,w\in{\mathbb Z}_q^n$.
Then $\mbox{\rm d}(v,w)<2$, and thus~$v,\,w$ differ in exactly one position.
Without loss of generality let $v_1\neq w_1$.
But then any other vertex contained in~$I$, say~$z$, satisfies $\mbox{\rm d}(z,v)=1=\mbox{\rm d}(z,w)$,
and therefore~$z$ also differs from~$v$ and~$w$ only in the first coordinate.
As a consequence, maximality of~$I$ yields $I=\{(\alpha,v_2,\ldots,v_n)\mid \alpha\in{\mathbb Z}_q\}=\{v+\alpha e_1\mid \alpha\in{\mathbb Z}_q\}$,
and thus $|I|=q$.
Now the statements follow from~\eqref{e-IndSetChi} and~\eqref{e-EvenCol}.
\end{proof}

The proof shows that each maximal independent set of $H_q(n,2)$ is the color class of a suitable coordinate coloring (based on $n-1$ coordinates).
However, this does not imply that each $q^{n-1}$-coloring is a coordinate coloring.
We will see this explicitly in Example~\ref{E-ColH232} below.

Since the chromatic number of any graph is always at least as large as the clique number, and cliques in $H_q(n,d)$ are codes
in ${\mathbb Z}_q^n$ of distance~$d$, an affirmative answer to Question~\ref{Conj-chi} can be deduced from the existence of MDS codes.
Recall that a $q$-ary code of length~$n$, cardinality~$M$, and distance~$d$ is called an (unrestricted) $(n,M,d)_q$-code.
The Singleton bound, see~\cite[Thm.~2.4.1]{HP03}, states that for such a code $M\leq q^{n-d+1}$.
Codes attaining this bound are called \emph{MDS codes}, thus they are $(n,q^{n-d+1},d)_q$-codes.
The existence of (unrestricted) MDS codes is a longstanding open problem for most parameters.
We refer to the literature on details about the conjecture; see for
instance~\cite{KKO15} by Kokkala et al.\ and the references therein.
We summarize the relation between existence of MDS codes and the chromatic number as follows.

\begin{rem}\label{R-MDS}
If there exists an $(n,q^{n-d+1},d)_q$-code, then $\chi(H_q(n,d))=q^{n-d+1}$ because
the MDS code in question forms a clique of size~$q^{n-d+1}$ in the Hamming graph.
Again, this is only a sufficient condition for $\chi(H_q(n,d))=q^{n-d+1}$.
For instance, by Theorem~\ref{T-H2nnm1} we have $\chi(H_2(n,n-1))=4$ for all $n$, but there exists no $(n,4,n-1)_2$-code for $n>3$.
The latter follows from the well-known non-existence of nontrivial binary MDS codes, but can also be deduced from the girth in
Proposition~\ref{P-cycles}(c).
Similarly, we have seen already in Corollary~\ref{C-ConjCases}(b) that $\chi(H_3(n,n-1))=9$ for all~$n\geq2$,
but there exists no $(n,9,n-1)_3$-code for $n\geq5$ thanks to the Plotkin bound~\cite[Thm.~2.2.1]{HP03}.
\end{rem}

Of course, for a single Hamming graph, if not too big, one can determine its chromatic number, and actually its colorings, via its
\emph{$r$-coloring ideal} for given~$r$.
For a graph $G=(V,E)$ this ideal is defined as
\begin{equation}\label{e-ColIdeal}
  {\mathcal I}_r(G):=\big\langle \{x_v^r-1\mid v\in V\}\cup \{{\textstyle\sum_{j=0}^{r-1} x_v^jx_w^{r-1-j}}\mid (v,w)\in E\}\big\rangle\subseteq{\mathbb C}[x_v\mid v\in V],
\end{equation}
where we associate independent indeterminates to the vertices of~$G$.
It is well known -- and easy to see -- that $G$ is $r$-colorable if and only if ${\mathcal I}_r(G)\neq{\mathbb C}[x_v\mid v\in V]$.
In this case the zeros of~${\mathcal I}_r(G)$ in~${\mathbb C}^{|V|}$ correspond to the $r$-colorings of~$G$
(the ideal ${\mathcal I}_r(G)$ is radical; see Hillar/Windfeldt~\cite[Lem.~3.2]{HiWi08}).
Using this method we obtain
\begin{rem}\label{R-Small}
$\chi(H_2(n,n-2))=8$ for $4\leq n\leq 7$.
\end{rem}

We will briefly return to the $r$-coloring ideal in the next section when considering all $4$-colorings of $H_2(3,2)$.

\section{On the Minimal Colorings of $H_2(n,n-1)$}
In this section we study the $4$-colorings of the graphs~$H_2(n,n-1)$.
Recall from Theorem~\ref{T-H2nnm1} that these are indeed the minimal colorings.
The motivation of this study arose from the following result by Alon et al.~\cite{ADFS04}.
It has been proven already earlier by Greenwell/Lov\'{a}sz in~\cite{GrLo74}, but Alon et al.\ provide an interesting new proof based
on Fourier analysis on the group ${\mathbb Z}_q^n$.

\begin{theo}[\mbox{\cite[Thm.~1.1, Claim~4.1]{ADFS04}}]\label{T-qnn}
Let $q\geq3$. Then $\chi(H_q(n,n))= q$ and every $q$-coloring of $H_q(n,n)$ is a coordinate-coloring.
\end{theo}

In other words, the minimal colorings of $H_q(n,n)$ are exactly the coordinate colorings.
It turns out that this is not the case for the Hamming graphs $H_q(n,n-1)$ so that there are indeed more $q^2$-colorings.
We will show some small examples for $q=2$ later in this section, and in Section~\ref{S-OpenProb} a $9$-coloring of $H_3(4,3)$ is given that is not a
coordinate coloring.

The following notion will be central to our investigation.

\begin{defi}\label{D-TransEdges}
Let $G=(V,E)$ be an undirected simple graph with proper $k$-coloring $K:V\longrightarrow [k]$.
Let $(x,y)\in E$. Then the edge $(x,y)$ is a \emph{transition edge for~$K$} if the map
\[
  K': V\longrightarrow[k],\quad v\longmapsto\left\{\begin{array}{ll} K(x),&\text{if }v=y,\\ K(y),&\text{if }v=x,\\ K(v),&\text{ if }v\not\in\{x,y\}
      \end{array}\right.
\]
is a proper $k$-coloring of~$G$.
In other words, $(x,y)$ is a transition edge if we may swap the colors of~$x$ and~$y$ without destroying properness of the coloring.
In this case, we call~$K'$ the coloring obtained by \emph{swapping colors along the edge $(x,y)$}.
We define
\[
    T(K):=\{(x,y)\mid (x,y)\text{ is a transition edge for }K\}\subseteq E
\]
as the \emph{transition space} of the coloring~$K$.
For any $x\in V$ we also define
\[
   T_x(K):=\{y\in V\mid (x,y)\in T(K)\}
\]
as the set of all neighbors of~$x$ that are adjacent to~$x$ via a transition edge.
\end{defi}
We have the following simple characterization of transition edges.
\begin{rem}\label{R-TransEdges}
Let~$G$ and~$K$ be as in Definition~\ref{D-TransEdges}. Let $(x,y)\in E$. Then
$(x,y)$ is a transition edge for~$K$ iff~$x$ is the only neighbor of~$y$ with color $K(x)$ and~$y$ is the
only neighbor of~$x$ with color $K(y)$.
In other words,
\[
  (x,y)\in T(K)\Longleftrightarrow K^{-1}(K(x))\cap{\mathcal N}(y)=\{x\}\text{ and }K^{-1}(K(y))\cap{\mathcal N}(x)=\{y\}.
\]
\end{rem}

The number of transition edges of a given coloring may be regarded as a measure of robustness of that coloring
in the sense that  the coloring tolerates swaps of colors along such edges.
We make this precise with the following notion.

\begin{defi}\label{D-Robust}
Let $G=(V,E)$ be a simple undirected graph.
\begin{alphalist}
\item We define the \emph{robustness} of a $k$-coloring~$K:G\longrightarrow[k]$ as
      $\mbox{\rm rb}(K)=\frac{|T(K)|}{|E|}$.
\item The \emph{$k$-coloring robustness of~$G$} is defined as
      \[
          \mbox{\rm rb}_k(G)=\max\{\mbox{\rm rb}(K)\mid K\text{ is a $k$-coloring of }G\}.
      \]
\end{alphalist}
\end{defi}
Clearly, if $k\geq|V(G)|$ then $\mbox{\rm rb}_k(G)=1$ because we may color each vertex differently.

Now we are ready to consider some small examples.
\begin{exa}\label{E-ColH232}
Consider the graph $G:=H_2(3,2)$ with vertex set~${\mathbb Z}_2^3$.
      \begin{center}
      \resizebox{180pt}{130pt}{\begin{tikzpicture}[scale=0.5]
      \tikzstyle{every node}=[draw,circle,fill=white,minimum size=10pt, inner sep=8pt]
           \draw (0,2) node (000) [label=center:000] {} ;
           \draw (0,0) node (101) [label=center:101] {} ;
           \draw (-3,0) node (011) [label=center:011] {} ;
           \draw (3,0) node (110) [label=center:110] {} ;
           \draw (0,-2) node (010) [label=center:010] {} ;
           \draw (3,-2) node (001) [label=center:001] {} ;
           \draw (-3,-2) node (100) [label=center:100] {} ;
           \draw (0,-4) node (111) [label=center:111] {} ;

           \draw (000) to (101);
           \draw (011) to (101);
           \draw (110) to (101);
           \draw (010) to (101);
           \draw (000) to (110);
           \draw (000) to (011);
           \draw (011) to (100);
           \draw (100) to (111);
           \draw (100) to (010);
           \draw (111) to (010);
           \draw (111) to (001);
           \draw (001) to (110);
           \draw (010) to (001);
           \draw (011) to [out=335,in=205](110);
           \draw (100) to [out=335,in=205](001);
           \draw(111) to [out=180, in=180,distance=6cm] (000);
           \end{tikzpicture}}
           \\
           {\footnotesize Figure~1: $H_2(3,2)$}
           \end{center}
      Using, for instance, the $4$-coloring ideal from~\eqref{e-ColIdeal} one obtains the following~$9$ colorings of~$G$.
      These are all colorings up to isomorphism.

      \begin{align*}
        \begin{array}{|c||c|c|c|c|}
        \hline
         K_1&000,\ 001&100,\ 101&010,\ 011&110,\ 111\\ \hline
         K_2&000,\ 010&100,\ 110&001,\ 011&101,\ 111\\ \hline
         K_3&000,\ 100&010,\ 110&001,\ 101&011,\ 111\\ \hline
         K_4&000,\ 100&010,\ 110&001,\ 011&101,\ 111\\ \hline
         K_5&000,\ 100&010,\ 011&001,\ 101&110,\ 111\\ \hline
         K_6&000,\ 010&100,\ 110&001,\ 101&011,\ 111\\ \hline
         K_7&000,\ 010&100,\ 101&001,\ 011&110,\ 111\\ \hline
         K_8&000,\ 001&100,\ 110&010,\ 011&101,\ 111\\ \hline
         K_9&000,\ 001&100,\ 101&010,\ 110&011,\ 111\\ \hline
       \end{array}\\
       \text{\footnotesize Figure~2: All colorings of $H_2(3,2)$\hspace*{1cm}}
      \end{align*}
      The first three rows represent the $(1,2)$-, $(1,3)$-, $(2,3)$-coordinate colorings, respectively.
      The last 6 colorings are obtained from the coordinate colorings by swapping colors along a transition edge.
      For example,~$K_4$ can be obtained from~$K_3$ by swapping the colors of $011$ and $101$ or from~$K_2$ be swapping
      the colors of $010$ and $100$.
      Similarly,~$K_5$ can be obtained from~$K_3$ by swapping the colors of $011$ and $110$ or from~$K_1$ by
      swapping the color of $100$ and $001$.
      In the same way, each of~$K_6,\ldots,K_9$ can be obtained from two different coordinate colorings by swapping colors along a certain transition edge.
      All of this shows that each minimal coloring of~$G$ is either a coordinate coloring or just one swap away from a coordinate coloring.
      In particular, each minimal coloring is even.

      The following two figures display the graph with two different colorings and their transition edges shown in zigzag.
      The left one shows the $(2,3)$-coordinate coloring (coloring~$K_3$) and the right one shows coloring~$K_6$.
      Note that for the $(2,3)$-coordinate coloring we have~$8$ transition edges, and they tile the graph in two $4$-cycles
      (in the sense of Def.~\ref{D-Tiling} later in this paper).
      In contrast, for coloring~$K_6$ we only have~$4$ transition edges.
      Investigating all~$9$ minimal colorings we obtain
      \[
         \mbox{\rm rb}(K_i)=\left\{\begin{array}{ll}\frac{1}{2},&\text{for }i=1,2,3,\\[.7ex] \frac{1}{4},&\text{for }i=4,\ldots,9.\end{array}\right.
      \]
      \begin{center}
      \resizebox{400pt}{140pt}{\begin{tikzpicture}[scale=0.6]
    \tikzstyle{every node}=[draw,circle,fill=white,minimum size=10pt, inner sep=8pt]

\draw[dashed] (0,2) node (000) [label=center:000] {} ;
\draw[very thick] (0,0) node (101) [label=center:101] {} ;
\draw (-3,0) node (011) [label=center:011] {} ;
\draw[dotted, thick] (3,0) node (110) [label=center:110] {} ;
\draw[dotted, thick] (0,-2) node (010) [label=center:010] {} ;
\draw[very thick] (3,-2) node (001) [label=center:001] {} ;
\draw[dashed] (-3,-2) node (100) [label=center:100] {} ;
\draw (0,-4) node (111) [label=center:111] {} ;

\draw[line width=1.8pt] decorate [decoration={zigzag}] {(000) -- (101)};
\draw[line width=1.8pt] decorate [decoration={zigzag}] { (011) to (101)};
\draw (110) to (101);
\draw (010) to (101);
\draw[line width=1.8pt] decorate [decoration={zigzag}] { (000) to (110)};
\draw (000) to (011);
\draw (011) to (100);
\draw (100) to (111);
\draw[line width=1.8pt] decorate [decoration={zigzag}] { (100) to (010)};
\draw[line width=1.8pt] decorate [decoration={zigzag}] { (111) to (010)};
\draw[line width=1.8pt] decorate [decoration={zigzag}] { (111) to (001)};
\draw (001) to (110);
\draw (010) to (001);
\draw[line width=1.8pt] decorate [decoration={zigzag}] { (011) to [out=335,in=205](110)};
\draw[line width=1.8pt] decorate [decoration={zigzag}] {(100) to [out=335,in=205] (001)};
\draw(111) to [out=180, in=180,distance=6cm] (000);

\tikzstyle{every node}=[]
\end{tikzpicture}
  \begin{tikzpicture}[scale=0.6]
    \tikzstyle{every node}=[draw,circle,fill=white,minimum size=10pt, inner sep=8pt]

\draw[dashed] (0,2) node (000) [label=center:000] {} ;
\draw[very thick] (0,0) node (101) [label=center:101] {} ;
\draw[dotted,thick] (-3,0) node (011) [label=center:011] {} ;
\draw (3,0) node (110) [label=center:110] {} ;
\draw[dashed] (0,-2) node (010) [label=center:010] {} ;
\draw[very thick] (3,-2) node (001) [label=center:001] {} ;
\draw (-3,-2) node (100) [label=center:100] {} ;
\draw[dotted,thick] (0,-4) node (111) [label=center:111] {} ;

\draw (000) to (101);
\draw[line width=1.8pt] decorate [decoration={zigzag}] { (011) to (101)};
\draw (110) to (101);
\draw (010) to (101);
\draw[line width=1.8pt] decorate [decoration={zigzag}] { (000) to (110)};
\draw (000) to (011);
\draw (011) to (100);
\draw (100) to (111);
\draw[line width=1.8pt] decorate [decoration={zigzag}] { (100) to (010)};
\draw (111) to (010);
\draw[line width=1.8pt] decorate [decoration={zigzag}] { (111) to (001)};
\draw (001) to (110);
\draw (010) to (001);
\draw (011) to [out=335,in=205](110);
\draw (100) to [out=335,in=205](001);
\draw(111) to [out=180, in=180,distance=6cm] (000);

\tikzstyle{every node}=[]
\end{tikzpicture}}
\\
{\footnotesize Fig.~3: $(2,3)$-coordinate coloring with transition edges\hspace*{1cm}Fig.~4: Coloring~$K_6$ with transition edges}
\end{center}
\end{exa}

\begin{exa}\label{E-ColH243}
Consider now the Hamming graph $G=H_2(4,3)$, shown in Figure~5.
In this case one obtains an abundance of $4$-colorings.
We illustrate just a few particular phenomena.
In addition to the 6 coordinate colorings we have for instance the colorings
\begin{align*}
   \begin{array}{|c||p{6.5em}|p{6.5em}|p{6.5em}|p{6.5em}|}
   \hline
   K_1&0000,1000,&0010,1010,&0001,1001,&1110,1101,1011,\\
    &0100,1100 &0110      &0101,0011 &0111,1111\\
    \hline
   K_2&0001, 0010,&1110, 1101,&1111, 1100&0000, 0011,\\
       &0100, 1000 &1011, 0111& 0110, 1010 &0101, 1001\\
   \hline
   \end{array}
\end{align*}
While the first one is an uneven coloring, the second one is even.
Moreover,~$K_2$ is more than one swap away from a coordinate coloring
(of course, the uneven coloring~$K_1$ cannot be obtained by any number of swaps from a coordinate coloring).
Furthermore, one can check straightforwardly that coloring~$K_1$ has~$3$ transition edges,
and coloring~$K_2$ has~$8$ transition edges.
In addition, for~$K_2$ one may move, for instance, $0000$ into the first color class and/or
$1111$ into the second color class to obtain an uneven proper $4$-coloring.
Similarly, moving $0000$ to the third color class of~$K_1$ leads to yet another uneven $4$-coloring.

\begin{center}
    \includegraphics[height=8.5cm]{H243Figure.pdf}
    \\
    {\footnotesize Figure 5: $H_2(4,3)$}
\end{center}

In Figure~6 we show the $(1,2)$-coordinate coloring along with its transition edges.
As for $H_2(3,2)$ the latter tile the graph in~$4$-cycles (in the sense of Def.~\ref{D-Tiling} later in this paper).
In particular, it has~$16$ transition edges and thus the highest robustness among all colorings discussed in this example.

\begin{center}
    \includegraphics[height=8.5cm]{H243TransFigure.pdf}
    \\
    {\footnotesize Figure 6: $(1,2)$-coordinate coloring of $H_2(4,3)$ with transition edges}
\end{center}

\end{exa}

We now return to the study of $4$-colorings of general Hamming graphs $H_2(n,n-1)$.
As the examples above suggest, the coordinate colorings appear to be more robust (that is, have more transition edges)
than other $4$-colorings.
We will see that this is indeed true for all Hamming graphs $H_2(n,n-1)$.
In the next section all maximally robust $4$-colorings will be described explicitly. With one exception they are exactly the coordinate colorings.

Note that for binary Hamming graphs the edges carry a natural label.
Indeed, we may assign the label $x+y=x-y\in{\mathbb Z}_2^n$ to the edge $(x,y)$.
For the following it is helpful to have this edge labeling in mind.
Recall that the Hamming graph $G:=H_2(n,d)$ is the Cayley graph of the group ${\mathbb Z}_q^n$ with generating set
${\mathcal S}_d:=\{v\in{\mathbb Z}_2^n\mid \mbox{\rm wt}(v)\geq d\}$.
In other words, for all $x,y\in{\mathbb Z}_2^n$ we have
\begin{equation}\label{e-additivity}
  x+y\in{\mathcal S}_d\Longleftrightarrow(x,y)\in E(G) \Longleftrightarrow (x+z,y+z)\in E(G) \text{ for all }z\in{\mathbb Z}_2^n.
\end{equation}

\begin{defi}\label{D-TransGen}
Let~$K$ be a proper coloring of the Hamming graph $H_2(n,d)$, and let $T(K)$ be its transition space.
If there exists a nonempty subset ${\mathcal B}=\{v_1,\ldots,v_t\}\subseteq{\mathcal S}_d$ such that
\[
   T(K)=\{(x,y)\mid x+y\in{\mathcal B}\}
\]
we say that \emph{$T(K)$ is generated by~${\mathcal B}$} and write $T(K)=\ideal{{\mathcal B}}=\ideal{v_1,\ldots,v_t}$.
If no set~${\mathcal B}$ exists such that $T(K)=\ideal{{\mathcal B}}$ or if $T(K)=\emptyset$, we say that \emph{$T(K)$ is not generated}.
\end{defi}
Recall from Definition~\ref{D-TransEdges} the set $T_x(K)$ of transition neighbors of a given vertex~$x$.
With above terminology we have
\begin{equation}\label{e-transx}
    T(K)=\ideal{{\mathcal B}} \Longleftrightarrow T_x(K)=\{x+b\mid b\in{\mathcal B}\}=x+{\mathcal B} \text{ for all }x\in{\mathbb Z}_2^n.
\end{equation}
As this identity indicates, the existence of such a set~${\mathcal B}$ is quite a strong assumption.
In particular, every vertex is incident to the same number of transition edges.
In most cases the transition space of a coloring is not generated by a set~${\mathcal B}$.

\begin{exa}\label{E-TransGen}\
\begin{alphalist}
\item Figure~3 shows that for the $(2,3)$-coordinate coloring of $H_2(3,2)$ we have $T(K)=\ideal{101,110}$.
      For the coloring~$K_6$ shown in Figure~4, we have $T(K)=\ideal{110}$.
\item From Figure~6 we obtain that for the $(1,2)$-coordinate coloring of $H_2(4,3)$ the transition space is generated by
      $\{0111,1011\}$.
      For the coloring~$K_2$ in Example~\ref{E-ColH243} we have $T(K_2)=\ideal{1111}$.
\item Here is an even coloring of $H_2(5,4)$ for which the transition space is nonempty and not generated.
      Take the $(1,2)$-coordinate coloring and swap the colors of vertices $00000$ and $10111$. This leads to an even
      $4$-coloring, say~$K$ (see also Prop.~\ref{P-TSCoord} below).
      Then one checks straightforwardly that $T_{10111}(K)=\{00000\}$ and $T_{00001}(K)=\{10110,01110\}$.
      This shows that $T(K)$ is not generated.
 \end{alphalist}
\end{exa}

It turns out that the transition space of a coordinate coloring of $H_2(n,n-1)$ is generated and the generating set
can be described explicitly.
To show this we define the following vectors of~${\mathbb Z}_2^n$. For $i=1,\ldots,n$ let
\[
   e_i:=(0,\ldots,0,1,0,\ldots,0)\ \text{ and }\ f_i:=e_i+{\mathbbold{1}}=(1,\ldots,1,0,1,\ldots,1),
\]
where~$1$ resp.~$0$ is at the $i$-th position.
Then for any vertex $x\in{\mathbb Z}_2^n$ its set of neighbors in $H_2(n,n-1)$ is given by
\begin{equation}\label{e-xNeigh}
   {\mathcal N}(x)=x+{\mathcal N}(0), \text{ where }\ {\mathcal N}(0)=\{{\mathbbold{1}},f_1,\ldots,f_n\}=\{v\in{\mathbb Z}_2^n\mid \mbox{\rm wt}(v)\geq n-1\}.
\end{equation}
Clearly, ${\mathcal N}(0)={\mathcal S}_{n-1}$, with~${\mathcal S}_d$ as in~\eqref{e-additivity}.

Before describing the transition spaces of coordinate colorings we first derive an upper bound for the robustness of a
$4$-coloring of $H_2(n,n-1)$.
The case $n=2$ differs from $n\geq 3$.
Indeed, $H_2(2,1)$ is the complete graph $K_4$ and thus each edge is a transition edge.
As a consequence, its robustness is~$1$.
From now on we will only be concerned with the case $n\geq 3$.

\begin{prop}\label{P-TransSpace}
Let $n\geq3$ and $K$ be a proper $4$-coloring of $H_2(n,n-1)$.
Then $|T_x(K)|\leq 2$ for all $x\in{\mathbb Z}_2^n$.
As a consequence, $\mbox{\rm rb}(K)\leq\frac{2}{n+1}$ with equality if and only if $|T_x(K)|=2$ for all $x\in{\mathbb Z}_2^n$.
\end{prop}
\begin{proof}
Fix any vertex $x\in{\mathbb Z}_2^n$ and consider its set of neighbors ${\mathcal N}(x)$, which consists of $n+1\geq4$ vertices; see~\eqref{e-xNeigh}.
They can comprise at most~$3$ colors (those different from $K(x)$), and this means that there exist
two neighbors that share a color.
By Remark~\ref{R-TransEdges} only neighbors that do not share a color with another neighbor of~$x$ can be
in $T_x(K)$.
Since there are at most two colors that are not shared by distinct neighbors, we conclude $|T_x(K)|\leq2$ .

For the second part we simply upper bound the number of transition edges.
Since any edge is shared by two vertices we have immediately $|T(K)|\leq\frac{2\cdot2^n}{2}=2^n$
with equality iff $|T_x(K)|=2$ for all $x\in{\mathbb Z}_2^n$.
Moreover, Proposition~\ref{P-basics}(a) yields $|E(H_2(n,n-1))|=(n+1)2^{n-1}$.
Now the statement follows from Definition~\ref{D-Robust}.
\end{proof}

Now we are ready to confirm what we have observed earlier in Example~\ref{E-ColH243}. The coordinate colorings are colorings with
maximal robustness, that is, maximal number of transition edges.
\begin{prop}\label{P-TSCoord}
Let $n\geq3$ and $K$ be the $(i,j)$-coordinate coloring of $H_2(n,n-1)$. Then $T(K)=\ideal{f_i,f_j}$ and thus $\mbox{\rm rb}(K)=\frac{2}{n+1}$.
As a consequence, $\mbox{\rm rb}_4(H_2(n,n-1))=\frac{2}{n+1}$.
\end{prop}
\begin{proof}
Without loss of generality let $(i,j)=(1,2)$.
Fix any vertex $x\in{\mathbb Z}_2^n$.
Since $K$ is the $(1,2)$-coordinate coloring, the neighbors $x+{\mathbbold{1}},x+f_3,\ldots,x+f_{n}$ have the same color, say~$A$.
Since $n\geq3$ these are at least two neighbors and therefore none of them can be incident to~$x$ via a transition edge.
Furthermore, $A\neq K(x+f_1)\neq K(x+f_2)\neq A$.
All of this shows that neither neighbor $x+f_1$ and $x+f_2$ shares a color with any other neighbor of~$x$.
Since this is true for all vertices $x\in{\mathbb Z}_2^n$ (and $x=(x+f_i)+f_i$), Remark~\ref{R-TransEdges} yields that $(x,x+f_1)$ and $(x,x+f_2)$ are
the transition edges incident to~$x$.
Now~\eqref{e-transx} and Proposition~\ref{P-TransSpace} conclude the proof.
\end{proof}

\begin{rem}\label{R-H2ndRobust}
The previous result can be generalized to the coordinate colorings of general binary Hamming graphs $H_2(n,d)$.
Precisely, let $K$ be the $(c_1,\ldots,c_{n-d+1})$-coordinate coloring of~$H_2(n,d)$.
Then one straightforwardly shows that
\[
  T(K)=\Big\langle\Big\{{\mathbbold{1}}+\sum_{j=1\atop j\neq i}^{n-d+1} e_{c_j}\,\Big|\, 1\leq i\leq n-d+1\Big\}\Big\rangle.
\]
This leads to the robustness $\mbox{\rm rb}(K)=\frac{n-d+1}{\sum_{i=0}^{n-d}{n \choose i}}$.
It is not clear whether this is the maximum robustness among all $2^{n-d+1}$-colorings of~$G$.
\end{rem}

In the next section we will describe explicitly the maximally robust $4$-colorings of $H_2(n,n-1)$.

\section{Maximally Robust \mbox{$4$}-Colorings of \mbox{$H_2(n,n-1)$}}
A characterization of the maximally robust $4$-colorings of $H_2(n,n-1)$ is derived in terms of their
transition spaces and all these colorings are presented explicitly (up to isomorphism).
In order to formulate these results, we need the following terminology.

\begin{defi}\label{D-Tiling}
Let~$G=(V,E)$ be a finite graph and $M\subseteq E$ be a set of edges in~$G$.
We say that \emph{$M$ tiles the graph in $4$-cycles} if~$M$ is the union of pairwise vertex-disjoint and edge-disjoint
$4$-cycles and every vertex appears on (exactly) one cycle.
\end{defi}
For example, in Figures~3 and~6 the transition edges of the given coloring tile the graph in $4$-cycles.

Now we are ready to present our main results.
The first theorem provides a characterization of maximally robust colorings in terms of the transition spaces.
The second theorem presents for each such transition space the unique coloring associated with it or shows that no
such coloring exists.
The proofs will be presented afterwards.

Recall from the paragraph right before Proposition~\ref{P-TransSpace} that the case $n=2$ is trivial.

\begin{theo}\label{T-MainThm}
Let $n\geq3$ and~$K$ be a $4$-coloring of $H_2(n,n-1)$.
The following are equivalent.
      \begin{romanlist}
      \item There exist $v,w\in{\mathcal N}(0)$ such that $T(K)=\ideal{v,w}$.
      \item $\mbox{\rm rb}(K)=\frac{2}{n+1}$.
      \item The transition edges tile the graph in $4$-cycles.
      \end{romanlist}
 If one, hence any of the above is true, then the coloring of a single $4$-cycle uniquely determines the coloring of the entire graph.
\end{theo}
Recall that if the transition space of a coloring is generated by a set~${\mathcal B}$, then
${\mathcal B}$ is contained in~${\mathcal N}(0)=\{{\mathbbold{1}},f_1,\ldots,f_n\}$.
Therefore the requirement  in i) that the vertices $v,\,w$ be in ${\mathcal N}(0)$ is not a restriction.

\begin{theo}\label{T-MainThm2}
Let $n\geq3$ and~$K$ be a $4$-coloring of $H_2(n,n-1)$.
\begin{arabiclist}
\item If $T(K)=\ideal{f_i,f_j}$ for some $1\leq i<j\leq n$, then $K$ is the $(i,j)$-coordinate coloring.
\item If $T(K)=\ideal{{\mathbbold{1}},f_j}$ for some~$j$, then~$n$ is even and~$K$ is the coloring with color sets
      \[
         {\mathcal A}^{\nu}_{\mu}:=\{v\in{\mathbb Z}_2^n\mid \mbox{\rm wt}(v)\equiv\nu\!\!\!\!\mod2,\ v_j=\mu\}\text{ for }\nu,\,\mu\in\{0,1\}.
      \]
\end{arabiclist}
As a consequence, any $4$-coloring of $H_2(n,n-1)$ with maximal robustness is even.
\end{theo}
Note that Part~2) tells us that if~$n$ is odd, then sets of the form $\{{\mathbbold{1}},f_j\}$ do not generate the
transition space of a $4$-coloring.

We prove the results in several steps and first need some preliminary results.
Before doing so, let us point out that for any $4$-coloring the graph $H_2(n,n-1)$ does not have cycles consisting
of transition edges of length~$3$.
For $n\geq4$ this is obvious by Proposition~\ref{P-cycles}(c), while for $n=3$ this can be verified via the Figures~3 and~4,
which cover all $4$-colorings of $H_2(3,2)$ up to graph isomorphism.
The following lemmas will lead to information about the existence, colors, and interrelation of $4$-cycles consisting of transition edges.

\begin{lemma}\label{L-H2n4}
Consider the graph $G:=H_2(n,n-1)$, where $n\geq3$. Let $x_1,x_2,x_3,x_4\in V(G)$ be distinct vertices such that
\begin{equation}\label{e-cycleai}
   (x_1,x_2),\, (x_2,x_3),\,(x_3,x_4),\,(x_4,x_1)\in E(G),
\end{equation}
that is, $x_1,\ldots,x_4$ are on a $4$-cycle. Then $x_1+x_2=x_3+x_4$ and thus $x_1+x_4=x_2+x_3$.
\end{lemma}
\begin{proof}
As all vectors are in ${\mathbb Z}_2^n$ it suffices to show $x_1+x_2=x_3+x_4$.
Since $x_1,\ldots,x_4$ are distinct, we have
\[
  x_1+x_2\neq x_2+x_3\neq x_3+x_4.
\]
By~\eqref{e-cycleai} and~\eqref{e-additivity} all these vectors are in ${\mathcal N}(0)=\{{\mathbbold{1}},f_1,\ldots,f_n\}$.
Using that $x_1+x_4=(x_1+x_2)+(x_2+x_3)+(x_3+x_4)$, we have $\mbox{\rm wt}\big((x_1+x_2)+(x_2+x_3)+(x_3+x_4)\big)=\mbox{\rm wt}(x_1+x_4)\geq n-1$.
But since the sum of any three distinct vectors from ${\mathcal N}(0)$ has weight at most~$n-2$, we conclude
$x_1+x_2=x_3+x_4$.
\end{proof}

\begin{lemma}\label{L-4Coloring}
Let $n\geq3$ and let~$K$ be a $4$-coloring of $H_2(n,n-1)$.
\begin{alphalist}
\item Suppose there exists a path of length~$3$ consisting of transition edges and passing through the
      vertices $x_1,x_2,x_3,x_4$.
      Then the colors of~$x_1,x_2,x_3,x_4$ are distinct.
\item There exists no simple path in~$H_2(n,n-1)$ of length greater than~$3$ consisting of transition edges.
\end{alphalist}
\end{lemma}
\begin{proof}
Both claims are easily verified if $n=3$ as there are only~$9$ colorings to check; see Figure~2.
Indeed, Figures~3 and~4 show (up to graph isomorphism) the only possible scenarios of transition edges.
Thus we may assume $n\geq4$.
\\
(a)  Since $(x_1,x_2),(x_2,x_3),(x_3,x_4)$ are transition edges, the only vertices that may share a color are~$x_1$ and~$x_4$.
Pick a vector $y\in{\mathcal N}(0)\,\backslash\,\{x_1+x_2,\,x_2+x_3,\,x_3+x_4\}$. This is possible because $n\geq3$.
By~\eqref{e-additivity} the vertices $x_2+y$ and $x_3+y$ are adjacent.
Since the girth is~$4$ thanks to Proposition~\ref{P-cycles}(c), the choice of~$y$ implies that the vertices $x_1,x_2,x_3,x_4,x_2+y,x_3+y$ are distinct.
Thus we have the subgraph
\begin{center}
\begin{tikzpicture}[scale=0.45]
    \draw (0,2) node (x) [label=center:$x_1$] {} ;
    \draw (5,2) node (v) [label=center:$x_2$] {} ;
    \draw (10,2) node (w) [label=center:$x_3$] {} ;
    \draw (15,2) node (z) [label=center:$x_4$] {} ;
    \draw (5,0) node (vy) [label=center:\raisebox{-2ex}{$x_2+y$}] {} ;
    \draw (10,0) node (wy) [label=center:\raisebox{-2ex}{$x_3+y$}] {} ;
    \draw (6,0) node(a1) {};
    \draw (9,0) node (a2) {};

    \draw (x) to (v);
    \draw (v) to (w);
    \draw (w) to (z);
    \draw (vy) to (v);
    \draw (wy) to (w);
    \draw (a1) to (a2);

\end{tikzpicture}
\end{center}
Since $(x_1,x_2)$ and $(x_2,x_3)$ are transition edges, we conclude $K(x_2+y)=K(x_4)$.
In the same way $K(x_3+y)=K(x_1)$.
Now the adjacency of $x_2+y$ and $x_3+y$ implies $K(x_1)\neq K(x_4)$.
All of this shows that $x_1,x_2,x_3,x_4$ assume distinct colors.
\\
(b) Suppose there exists a path consisting of transition edges passing through the vertices
$x_1,\ldots,x_5$, and where $x_i\neq x_j$ for $i\neq j$.
From Part~(a) we know that $x_1,x_2,x_3,x_4$ have distinct colors and the same is true for $x_2,x_3,x_4,x_5$.
Thus we conclude $K(x_1)=K(x_5)$.
Consider the vertex $x_2+x_3+x_4$, which is adjacent to $x_2$ and $x_4$ by~\eqref{e-additivity}. Thus we have
\begin{center}
\begin{tikzpicture}[scale=0.45]
    \draw (0,2) node (x) [label=center:$x_1$] {} ;
    \draw (5,2) node (v) [label=center:$x_2$] {} ;
    \draw (10,2) node (w) [label=center:$x_3$] {} ;
    \draw (15,2) node (z) [label=center:$x_4$] {} ;
    \draw (20,2) node (zz) [label=center:$x_5$] {} ;
    \draw (10,0) node (vy) [label=center:\raisebox{-2ex}{$x_2+x_3+x_4$}] {} ;
    \draw (11,0) node(a1) {};
    \draw (9,0) node (a2) {};

    \draw (x) to (v);
    \draw (v) to (w);
    \draw (w) to (z);
    \draw (z) to (zz);
    \draw (a1) to (z);
    \draw (a2) to (v);
    \end{tikzpicture}
\end{center}
The fact that the upper row consists of transition edges implies that $x_2+x_3+x_4$ must equal $x_1$ or $x_5$ for otherwise there is
no color left for $x_2+x_3+x_4$.
Assume without loss of generality that $x_2+x_3+x_4=x_1$. But then $K(x_5)=K(x_1)=K(x_2+x_3+x_4)$, contradicting the fact
that $(x_4,x_5)$ is a transition edge.
Thus we have shown that no such path exists.
\end{proof}

By the previous lemma there are no cycles of length greater than~$4$ in $H_2(n,n-1)$ consisting of transition edges.
The next lemma provides information about cycles of length~$4$ consisting of transition edges.

\begin{lemma}\label{L-4cycle}
Let $n\geq3$ and let~$K$ be a $4$-coloring of $G:=H_2(n,n-1)$.
Let $x_1,x_2,x_3,x_4\in V(G)$ be distinct vertices such that
\[
   (x_1,x_2),\, (x_2,x_3),\,(x_3,x_4),\,(x_4,x_1)\in T(K),
\]
that is, $x_1,\ldots,x_4$ are on a $4$-cycle whose edges are transition edges of~$K$.
Then
\begin{alphalist}
\item The colors $K(x_1),\ldots,K(x_4)$ are distinct.
\item Let $y\in V(G)\backslash\{x_1,\ldots,x_4\}$ be any other vertex of~$G$. Then~$y$ is adjacent to at most one of the vertices
      $x_1,\ldots,x_4$.
      Furthermore, if~$y$ is adjacent to~$x_i$, then $K(y)=K(\tilde{x_i})$, where $\tilde{x_i}$
      denotes the vertex opposite to~$x_i$ in the $4$-cycle.
\end{alphalist}
\end{lemma}

\begin{proof}
Consider the given $4$-cycle with its opposite vertices
\begin{equation}\label{e-4cycle}
\text{\begin{minipage}{5cm}
\begin{tikzpicture}[scale=0.45]
    \draw (4,0) node (a3) [label=center:\raisebox{-.7ex}{$x_3$}] {} ;
    \draw (0,2) node (a2) [label=center:$x_2\;$] {} ;
    \draw (8,2) node (a4) [label=center:$\;x_4$] {} ;
    \draw (4,4) node (a1) [label=center:\raisebox{.7ex}{$x_1$}] {} ;
    \draw (a3) to (a2);
    \draw (a1) to (a4);
    \draw (a3) to (a4);
    \draw (a1) to (a2);
\end{tikzpicture}
\end{minipage}
\qquad\begin{minipage}{4cm} $\tilde{x_1}=x_3$\\[.7ex] $\tilde{x_3}=x_1$\\[.7ex] $\tilde{x_2}=x_4$\\[.7ex] $\tilde{x_4}=x_2$\end{minipage}}
\end{equation}
(a) follows from Lemma~\ref{L-4Coloring}(a).
\\
(b) Let~$y\in V(G)\backslash\{x_1,\ldots,x_4\}$.
Assume $x_1\sim y\sim x_2$. Then $K(x_1)\neq K(y)\neq K(x_2)$.
But since $(x_1,x_4)$ and $(x_2,x_3)$ are transition edges, we also have $K(x_4)\neq K(y)\neq K(x_3)$.
This contradicts that~$K$ is a $4$-coloring. In the same way one shows that~$y$ cannot be adjacent to two opposite vertices
of the $4$-cycle.
Assume now $y\sim x_1$. Then, again, because $(x_1,x_2)$ and $(x_1,x_4)$ are transition edges,~$y$ must have color $K(x_3)=K(\tilde{x_1})$.
\end{proof}

Now we are ready to prove the main theorems.

\noindent\emph{Proof of Theorem~\ref{T-MainThm}.}
i)~$\Rightarrow$~ii) follows from Proposition~\ref{P-TransSpace}.
\\
ii)~$\Rightarrow$~iii)
Example~\ref{E-ColH232} tells us that the only colorings of $H_2(3,2)$ with maximal robustness are
the coordinate colorings. Therefore the implication is easily verified for $n=3$; see Figure~3.
Thus let $n\geq4$ and hence $\text{girth}(H_2(n,n-1))=4$ due to Proposition~\ref{P-cycles}(c).
Thanks to Proposition~\ref{P-TransSpace} we have $|T_x(K)|=2$ for all $x\in{\mathbb Z}_2^n$, that is, every vertex is incident
to exactly two transition edges.
The finiteness of the graph then implies that every vertex is on a unique cycle consisting of transition edges, and
due to Lemma~\ref{L-4Coloring}(b) all these cycles have length~$4$.
\\
iii)~$\Rightarrow$~i)
Let $(0,v),(v,z),(z,w),(w,0)$ be the $4$-cycle consisting of transition edges containing the vertex~$0$.
From Lemma~\ref{L-H2n4} we obtain $v=w+z$, thus $z=v+w$.
This shows that $T_x(K)=x+\{v,w\}$ for $x\in\{0,v,w,z\}$.
Note also that $\mbox{\rm wt}(v),\,\mbox{\rm wt}(w)\geq n-1$.
Let now $x\in V(H_2(n,n-1))\,\backslash\{0,v,w,z\}$ be any other vertex. We have to show that $T_x(K)=x+\{v,w\}$.
We consider two cases.
\\
\underline{Case 1:} $x$ is adjacent to one of the vertices $\{0,v,w,z\}$. In this case it is adjacent to exactly one of these
vertices thanks to Lemma~\ref{L-4cycle}(b).
Without loss of generality we may assume $x\sim0$, which then implies $\mbox{\rm wt}(x)\geq n-1$.
Then by~\eqref{e-additivity}
\begin{equation}\label{e-shiftcycle}
  (x,x+v),\,(x+v,x+z),\,(x+z,x+w),\,(x+w,x)
\end{equation}
is a $4$-cycle in $H_2(n,n-1)$.
It can be thought of as a shift by~$x$ of the original cycle.
Again by~\eqref{e-additivity} we obtain that $x+y\sim y$ for $y\in\{0,v,w,z\}$.
Thus we have the subgraph
\begin{center}
\begin{tikzpicture}[scale=0.45]
    \draw (4,0) node (z) [label=center:\raisebox{-.7ex}{$z$}] {} ;
    \draw (0,2) node (v) [label=center:$v\;$] {} ;
    \draw (8,2) node (w) [label=center:$\;w$] {} ;
    \draw (4,4) node (0) [label=center:\raisebox{.7ex}{$0$}] {} ;
    \draw (z) to (v);
    \draw (0) to (w);
    \draw (z) to (w);
    \draw (0) to (v);

    \draw (17,0) node (xz) [label=center:\raisebox{-.7ex}{$x+z$}] {} ;
    \draw (13,2) node (xv) [label=center:$x+v\;$] {} ;
    \draw (21,2) node (xw) [label=center:$\;x+w$] {} ;
    \draw (17,4) node (x) [label=center:\raisebox{.7ex}{$x$}] {} ;
    \draw (xz) to (xv);
    \draw (x) to (xw);
    \draw (xz) to (xw);
    \draw (x) to (xv);
    \draw (0) to [out=20,in=160] (x);
    \draw (v) to [out=20,in=160] (xv);
    \draw (w) to [out=20,in=160] (xw);
    \draw (z) to [out=20,in=160] (xz);

\end{tikzpicture}
\end{center}
Now Lemma~\ref{L-4cycle}(b) tells us that
\begin{equation}\label{e-colorsC}
    K(x)=K(z),\ K(x+v)=K(w),\ K(x+z)=K(0),\ K(x+w)=K(v).
\end{equation}
Using that $x\sim0$ we see that~$x$ has neighbors of the three distinct colors $K(0),\,K(w),\,K(v)$.
Now we can identify the transition edges incident to~$x$.
The fact that $T_0(K)=\{v,w\}$ tells us that $(x,0)$ is not a transition edge.
But then~$x$ cannot be incident to any transition edge $(x,y)$ such that $K(y)=K(0)$.
Since $K(v)$ and $K(w)$ are neighboring colors of~$x$ and by assumption~$x$ is on a $4$-cycle consisting of transition edges, we conclude that
$(x,x+v)$ and $(x,x+w)$ are the transition edges incident to~$x$.
Thus $T_x(K)=x+\{v,w\}$.
By generality of~$x$ all edges in the cycle~\eqref{e-shiftcycle} are transition edges.
Note also that the coloring of the cycle~\eqref{e-shiftcycle} is uniquely determined by~\eqref{e-colorsC}.
\\
\underline{Case~2:} $x$ is not adjacent to any vertex of the original $4$-cycle.
As we have shown in Proposition~\ref{P-basics}(e) the graph $H_2(n,n-1)$ is connected and therefore there exists a path
from~$0$ to~$x$. Assume the vertices of this path are $0,y_1,\ldots,y_t=x$.
With the aid of this path, we can now translate the original cycle across the graph and obtain new $4$-cycles consisting
of transition edges and whose colors are uniquely determined by the coloring of the original $4$-cycle.
Case~1 guarantees that in each step we obtain $T_{y_i}(K)=y_i+\{v,w\}$.
Thus we conclude $T_x(K)=x+\{v,w\}$, as desired.
This part also showed that the coloring~$K$ is uniquely determined by a single $4$-cycle,  and thus the proof is complete.
\mbox{}\hfill$\Box$

\medskip
\noindent\emph{Proof of Theorem~\ref{T-MainThm2}.}
1) From Theorem~\ref{T-MainThm} we know that there exists (up to isomorphism) at most one $4$-coloring~$K$ such that
$T(K)=\ideal{f_i,f_j}$.
Now the result follows from Proposition~\ref{P-TSCoord}.
\\[1ex]
2) In what follows the parity of the Hamming weight will play a central role, and so we introduce
$\mbox{\rm wt}_2(x):=\mbox{\rm wt}(x)\!\!\!\mod2\in{\mathbb Z}_2$ for any $x\in{\mathbb Z}_2^n$ and thus compute with these weights modulo~$2$.
Recall that in~${\mathbb Z}_2^n$ we have $\mbox{\rm wt}(x+y)=\mbox{\rm wt}(x)+\mbox{\rm wt}(y)-2\big|\{i\mid x_i=1=y_i\}\big|$, and therefore
\begin{equation}\label{e-wtparity}
   \mbox{\rm wt}_2(x+y)=\mbox{\rm wt}_2(x)+\mbox{\rm wt}_2(y)\text{ for all }x,\,y\in{\mathbb Z}_2^n.
\end{equation}
We will also compute modulo~$2$ with the indices of the set~${\mathcal A}^{\nu}_{\mu}$ introduced in the theorem.

\noindent\underline{Case 1:} Assume~$n$ is even. By Theorem~\ref{T-MainThm} and Lemma~\ref{L-4cycle}(a) there is at most one coloring~$K$ such that
$T(K)=\ideal{{\mathbbold{1}},f_j}$.
Thus it suffices to verify that the given~$K$ satisfies the statements.
First of all, it is clear that the sets ${\mathcal A}^{\nu}_{\mu}$ are pairwise disjoint and partition the vertex set~${\mathbb Z}_2^n$.
Next, since $n$ is even, we have $\mbox{\rm wt}_2({\mathbbold{1}})=0$ and $\mbox{\rm wt}_2(f_i)=1$ for all $i=1,\ldots,n$.
This allows us to describe the behavior of the sets~${\mathcal A}^{\nu}_{\mu}$ along edges of the graph.
Indeed,~\eqref{e-wtparity} leads to
\begin{equation}\label{e-shiftA}
  x+{\mathcal A}^{\nu}_{\mu}=
  \left\{\begin{array}{ll}{\mathcal A}^{\nu}_{\mu+1},&\text{if }x={\mathbbold{1}},\\[.6ex]
         {\mathcal A}^{\nu+1}_{\mu},&\text{if }x=f_j,\\[.6ex]
         {\mathcal A}^{\nu+1}_{\mu+1},&\text{if }x=f_i\text{ for }i\neq j\end{array}\right.
\end{equation}
for all $\nu,\,\mu\in{\mathbb Z}_2$.
This shows that the sets ${\mathcal A}^{\nu}_{\mu}$ are independent and thus form the color classes of a proper $4$-coloring, say~$K$.
It remains to show that $T_x(K)=x+\{{\mathbbold{1}},f_j\}$ for all $x\in{\mathbb Z}_2^n$.
Due to~\eqref{e-shiftA} the vectors~${\mathbbold{1}}$ and~$f_j$ induce $4$-cycles in $H_2(n,n-1)$ of the form
\begin{center}
\begin{tikzpicture}[scale=0.45]
    \draw (4,0) node (a3) [label=center:\raisebox{-1ex}{${\mathcal A}^0_0$}] {} ;
    \draw (0,2) node (a2) [label=center:${\mathcal A}^1_0\;$] {} ;
    \draw (8,2) node (a4) [label=center:$\;{\mathcal A}^0_1$] {} ;
    \draw (4,4) node (a1) [label=center:\raisebox{.7ex}{${\mathcal A}^1_1$}] {} ;
    \draw (3.8,0.2) node (a31) {};
    \draw (4.2,0.2) node (a32) {};
    \draw (4.2,3.8) node (a12) {};
    \draw (3.8,3.8) node (a11) {};
    \draw (0.2,2) node (a22) {};
    \draw (7.8,2) node (a42) {};
    \draw (a31) to (a22);
    \draw (a12) to (a42);
    \draw (a32) to (a42);
    \draw (a11) to (a22);
    \draw (1.6,0.6) node (b) [label=center:$f_j$] {} ;
    \draw (6,0.6) node (c) [label=center:${\mathbbold{1}}$] {} ;
    \draw (1.6,3.4) node (d) [label=center:${\mathbbold{1}}$] {} ;
    \draw (6,3.6) node (e) [label=center:$f_j$] {} ;
\end{tikzpicture}
\end{center}
Furthermore, the last case in~\eqref{e-shiftA} tells us that the only other neighbors of a vertex in~${\mathcal A}^{\nu}_{\mu}$ are in
${\mathcal A}^{\nu+1}_{\mu+1}$ and thus all have the same color.
Since this color  is different from the neighboring colors in the cycle, the edges in these $4$-cycles are indeed all the transition
edges of~$K$, that is, $T(K)=\ideal{{\mathbbold{1}},f_j}$.
Identity~\eqref{e-shiftA} shows that the sets ${\mathcal A}^{\nu}_{\mu}$ all have the same cardinality and hence~$K$ is an even coloring.

\noindent\underline{Case 2:} Assume~$n$ is odd. We have to show that there is no proper $4$-coloring with
transition space~$\ideal{{\mathbbold{1}},f_j}$. Without loss of generality let $j=n$.
It will be beneficial to work again with the vertex partition ${\mathbb Z}_2^n={\mathcal A}^0_0\cup{\mathcal A}^0_1\cup{\mathcal A}^1_0\cup{\mathcal A}^1_1$
(which are not color classes at this point).
As~$n$ is odd we have for all $\nu,\,\mu\in{\mathbb Z}_2$
\begin{equation}\label{e-shiftB}
  x+{\mathcal A}^{\nu}_{\mu}=
  \left\{\begin{array}{ll}{\mathcal A}^{\nu+1}_{\mu+1},&\text{if }x={\mathbbold{1}},\\[.6ex]
         {\mathcal A}^{\nu}_{\mu},&\text{if }x=f_n,\\[.6ex]
         {\mathcal A}^{\nu}_{\mu+1},&\text{if }x=f_i\text{ for }i<n\end{array}\right.
\end{equation}
Thus $\ideal{{\mathbbold{1}},f_j}$ induces $4$-cycles with vertices in the sets ${\mathcal A}^{\nu}_{\mu}$ as follows
\begin{equation}\label{e-two4cycles}
\begin{array}{ll}
\begin{tikzpicture}[scale=0.45]
    \draw (4,0) node (a3) [label=center:\raisebox{-1ex}{${\mathcal A}^1_1$}] {} ;
    \draw (0,2) node (a2) [label=center:${\mathcal A}^1_1\;$] {} ;
    \draw (8,2) node (a4) [label=center:$\;{\mathcal A}^0_0$] {} ;
    \draw (4,4) node (a1) [label=center:\raisebox{.7ex}{${\mathcal A}^0_0$}] {} ;
    \draw (3.8,0.2) node (a31) {};
    \draw (4.2,0.2) node (a32) {};
    \draw (4.2,3.8) node (a12) {};
    \draw (3.8,3.8) node (a11) {};
    \draw (0.2,2) node (a22) {};
    \draw (7.8,2) node (a42) {};
    \draw (a31) to (a22);
    \draw (a12) to (a42);
    \draw (a32) to (a42);
    \draw (a11) to (a22);
    \draw (1.6,0.6) node (b) [label=center:$f_n$] {} ;
    \draw (6,0.6) node (c) [label=center:${\mathbbold{1}}$] {} ;
    \draw (1.6,3.4) node (d) [label=center:${\mathbbold{1}}$] {} ;
    \draw (6,3.6) node (e) [label=center:$f_n$] {} ;
\end{tikzpicture}&
\hspace*{1cm}
\begin{tikzpicture}[scale=0.45]
    \draw (4,0) node (a3) [label=center:\raisebox{-1ex}{${\mathcal A}^1_0$}] {} ;
    \draw (0,2) node (a2) [label=center:${\mathcal A}^1_0\;$] {} ;
    \draw (8,2) node (a4) [label=center:$\;{\mathcal A}^0_1$] {} ;
    \draw (4,4) node (a1) [label=center:\raisebox{.7ex}{${\mathcal A}^0_1$}] {} ;
    \draw (3.8,0.2) node (a31) {};
    \draw (4.2,0.2) node (a32) {};
    \draw (4.2,3.8) node (a12) {};
    \draw (3.8,3.8) node (a11) {};
    \draw (0.2,2) node (a22) {};
    \draw (7.8,2) node (a42) {};
    \draw (a31) to (a22);
    \draw (a12) to (a42);
    \draw (a32) to (a42);
    \draw (a11) to (a22);
    \draw (1.6,0.6) node (b) [label=center:$f_n$] {} ;
    \draw (6,0.6) node (c) [label=center:${\mathbbold{1}}$] {} ;
    \draw (1.6,3.4) node (d) [label=center:${\mathbbold{1}}$] {} ;
    \draw (6,3.6) node (e) [label=center:$f_n$] {} ;
\end{tikzpicture}
\end{array}
\end{equation}
Assume now that~$K$ is a proper $4$-coloring such that $T(K)=\ideal{{\mathbbold{1}},f_n}$.
Then the above $4$-cycles consist of transition edges.
Lemma~\ref{L-4cycle} yields that the vertices of any such cycle attain distinct colors.
Denote the $4$ colors by $A,B,C,D$.
Using $v=0\in{\mathcal A}^0_0$ as an instance of the left cycle, we have without loss of generality
\begin{equation}\label{e-inicolors}
  K(0)=A,\ K({\mathbbold{1}})=B,\ K(e_n)=C,\ K(f_n)=D.
\end{equation}
Theorem~\ref{T-MainThm} tells us that this determines uniquely the coloring of each other transition $4$-cycle (and thus of every vertex),
and Lemma~\ref{L-4cycle} specifies how this is done.
In order to describe this precisely, the following sets will be helpful.
For $\nu,\,\mu\in{\mathbb Z}_2$ and $i=0,\ldots,n$ define
\[
   B^{\nu}_{\mu}(i):=\{v\in{\mathcal A}^{\nu}_{\mu}\mid \mbox{\rm wt}(v)=i\}.
\]
Clearly, $B^{\nu}_{\mu}(i)=\emptyset$ if $i\not\equiv\nu\!\!\!\mod2$.
One easily verifies
\begin{equation}\label{e-Bcycle}
  {\mathbbold{1}}+B^{\nu}_{\mu}(i)=B^{\nu+1}_{\mu+1}(n-i),\quad
  f_n+B^{\nu}_0(i)=B^{\nu}_0(n-1-i),\quad
  f_n+B^{\nu}_1(i)=B^{\nu}_1(n+1-i).
\end{equation}
This shows that the vertices in the $4$-cycles in \eqref{e-two4cycles} specify to
\begin{equation}\label{e-twoBcycles}
\begin{array}{ll}
\begin{tikzpicture}[scale=0.45]
    \draw (4,-.4) node (a3) [label=center:$B^1_1(i+1)$] {} ;
    \draw (-1.5,2) node (a2) [label=center:$B^1_1(n-i)$] {} ;
    \draw (10.2,2) node (a4) [label=center:$\;B^0_0(n-1-i)$] {} ;
    \draw (4,4.3) node (a1) [label=center:$B^0_0(i)$] {} ;
    \draw (3.8,0.2) node (a31) {};
    \draw (4.2,0.2) node (a32) {};
    \draw (4.2,3.8) node (a12) {};
    \draw (3.8,3.8) node (a11) {};
    \draw (0.2,2) node (a22) {};
    \draw (7.8,2) node (a42) {};
    \draw (a31) to (a22);
    \draw (a12) to (a42);
    \draw (a32) to (a42);
    \draw (a11) to (a22);
    \draw (1.4,0.8) node (b) [label=center:$f_n$] {} ;
    \draw (6.3,0.8) node (c) [label=center:${\mathbbold{1}}$] {} ;
    \draw (1.4,3.2) node (d) [label=center:${\mathbbold{1}}$] {} ;
    \draw (6.3,3.4) node (e) [label=center:$f_n$] {} ;
\end{tikzpicture}&
\begin{tikzpicture}[scale=0.45]
    \draw (4,-.4) node (a3) [label=center:$B^1_0(n-1-i)$] {} ;
    \draw (-.7,2) node (a2) [label=center:$B^1_0(i)$] {} ;
    \draw (9.5,2) node (a4) [label=center:$B^0_1(i+1)$] {} ;
    \draw (4,4.3) node (a1) [label=center:$B^0_1(n-i)$] {} ;
    \draw (3.8,0.2) node (a31) {};
    \draw (4.2,0.2) node (a32) {};
    \draw (4.2,3.8) node (a12) {};
    \draw (3.8,3.8) node (a11) {};
    \draw (0.2,2) node (a22) {};
    \draw (7.8,2) node (a42) {};
    \draw (a31) to (a22);
    \draw (a12) to (a42);
    \draw (a32) to (a42);
    \draw (a11) to (a22);
    \draw (1.4,0.8) node (b) [label=center:$f_n$] {} ;
    \draw (6.3,0.8) node (c) [label=center:${\mathbbold{1}}$] {} ;
    \draw (1.4,3.2) node (d) [label=center:${\mathbbold{1}}$] {} ;
    \draw (6.3,3.4) node (e) [label=center:$f_n$] {} ;
\end{tikzpicture}
\end{array}
\end{equation}
The cycles on the left (resp.\ right) hand side exist only if~$i$ is even (resp.\ odd).
Let $n=2t+1$.
We claim that the sets $B^{\nu}_{\mu}(i)$ attain the following colors:
\begin{equation}\label{e-colors}
\left.\begin{array}{llll}
  K(B^0_0(i))=A,& K(B^1_0(n-1-i))=A,\qquad\\[.7ex]
  K(B^1_1(n-i))=B,& K(B^0_1(i+1))=B,\\[.7ex]
  K(B^1_1(i+1))=C,& K(B^0_1(n-i))=C,\\[.7ex]
  K(B^0_0(n-1-i))=D,\qquad& K(B^1_0(i))=D,
\end{array}\right\} \text{ for all }0\leq i\leq t.
\end{equation}
If we can prove this, we arrive at a contradiction because $B^0_0(t)=B^0_0(n-1-t)$.

In order to prove~\eqref{e-colors} we induct on~$i$.
For $i=0$ we have
\[
    B^0_0(0)=\{0\},\ B^1_1(n)=\{{\mathbbold{1}}\},\ B^1_1(1)=\{e_n\},\ B^0_0(n-1)=\{f_n\},
\]
and~\eqref{e-inicolors} establishes the left hand column of~\eqref{e-colors}.
The sets in the right hand column are all empty for $i=0$.

Let us now assume~\eqref{e-colors} for all $i<i'$.
Suppose~$i'$ is even and let $v\in B^0_0(i')$.
Let $\alpha\in\{1,\ldots,n-1\}$ be such that $v_{\alpha}=1$.
Then $w:=v+f_{\alpha}\in B^0_1(n+1-i')=B^0_1(n-(i'-1))$.
This means that~$w$ is the top vertex of a cycle as on the right hand side in~\eqref{e-twoBcycles}, whereas~$v$
is the top vertex of a cycle as on the left hand side.
These two cycles are obtained by a shift with~$f_{\alpha}$.
By assumption we know that the vertices of the right hand cycle assumes the colors $C,D,A,B$ counterclockwise with $K(w)=C$.
Now Lemma~\ref{L-4cycle} establishes the colors of the left hand cycle as in the first column of~\eqref{e-colors}.
The same reasoning applies to the case where~$j$ is odd, in which one starts with an arbitrary element in $B^1_0(i')$.
This concludes the proof.
\mbox{}\hfill$\Box$

\section{Open Problems}\label{S-OpenProb}
In this section we briefly address further questions pertaining to the coloring of the Hamming graphs.

\begin{que} First of all, it remains to answer Question~\ref{Conj-chi} for the cases not covered in Section~\ref{S-chi}.
\end{que}

\begin{que}
Can one describe the maximally robust $2^{n-d+1}$-colorings of $H_2(n,d)$?
Are their transition spaces generated?
Remark~\ref{R-H2ndRobust} is but a first step in this direction.
\end{que}

\begin{que}
From Corollary~\ref{C-ConjCases} we know that $\chi(H_q(n,n-1))=q^2$ for all $q\geq3$ and all $q^2$-colorings are even.
Can one derive further information about these minimal colorings?
\end{que}
Not surprisingly, just as in the binary case not all minimal colorings are coordinate colorings.
Here is a $9$-coloring of $H_3(4,3)$ that is not a coordinate coloring.
Consider the independent set ${\mathcal I}:=\{x\in{\mathbb Z}_3^4\mid \mbox{\rm wt}(x)\leq1\}$
and the linear MDS code (see Remark~\ref{R-MDS} and the paragraph preceeding it)
\begin{equation}\label{e-MDS}
   {\mathcal C}=\text{rowspace}\begin{pmatrix}0&1&1&1\\1&0&1&2\end{pmatrix}:=\{a(0111)+b(1012)\mid a,b\in{\mathbb Z}_3\}\subseteq{\mathbb Z}_3^4.
\end{equation}
Then each of the shifts $v+{\mathcal I},\,v\in{\mathcal C}$, is clearly an independent set, and these shifts are pairwise disjoint.
Thus they form the color classes of a $9$-coloring that is not a coordinate coloring.
Note that~${\mathcal I}$ is the set of coset leaders of the code~${\mathcal C}$
(that is, each $v\in{\mathcal I}$ is the unique vector of smallest weight in the coset~$v+{\mathcal C}$, and these cosets partition~${\mathbb Z}_3^4$).
In fact,~${\mathcal C}$ is a perfect code, see~\cite[Sec.~1.12]{HP03}.
This example thus generalizes whenever we have a linear perfect MDS code over a finite field.
The latter are exactly the Hamming codes with parameter $r=2$, hence the
$q$-ary Hamming codes of length~$n=q+1$, dimension $q-1$, and distance~$d=3$ and where~$q$ is a prime power and the alphabet
the finite field~${\mathbb F}_q$ of order~$q$; see for instance \cite[Thm.~1.12.3]{HP03}.
As a consequence, we obtain a $q^{q-1}$-coloring of $H_q(q+1,3)$ that is not a coordinate coloring.
As before, the color classes are the shifts of the independent set $\{x\in{\mathbb F}_q^{q+1}\mid \mbox{\rm wt}(x)\leq1\}$.

Incidentally, the example above can be utilized to create an uneven 27-coloring of $H_3(5,3)$
(recall however, that it is not clear whether this graph has chromatic number~$27$).
Using~${\mathcal C}$ as in~\eqref{e-MDS} we define the sets
\begin{align*}
  \hat{{\mathcal C}}&:=\{(v_1,\ldots,v_4,0)\mid (v_1,\ldots,v_4)\in{\mathcal C}\}\subseteq{\mathbb Z}_3^5,\\
  {\mathcal J}&:=\{v\in{\mathbb Z}_3^5\mid \mbox{\rm wt}(v)\leq 1\},\\
  {\mathcal B}_\alpha&:=\{(v_1,\ldots,v_4,\alpha)\mid \mbox{\rm wt}(v_1,\ldots,v_4)=1\} \text{ for }\alpha=1,2.
\end{align*}
Then~${\mathcal J}$ is an independent set of cardinality~$11$ (showing that the upper bound in Theorem~\ref{T-alpha}(b) is
attained for $H_3(5,3)$), and~${\mathcal B}_1$ and~${\mathcal B}_2$ are independent sets of size~$8$.
It is straightforward to see that the 27 sets $v+{\mathcal J},\,v+{\mathcal B}_1,\,v+{\mathcal B}_2$, where $v\in\hat{{\mathcal C}}$, form a partition of~${\mathbb Z}_3^5$
and thus serve as the color classes of an uneven $27$-coloring.

\begin{que}
Do the $q^{n-d+1}$-colorings of $H_q(n,d)$ for $q\geq3$ have transition edges?
\end{que}

For $d=1$ the graph is the complete graph
on $q^n$ vertices and thus $T(K)=E(H_q(n,1))$ for every $q^n$-coloring.
Furthermore, for $q\geq3,\,d\geq2$ it is easy to see that the $q^{n-d+1}$-coordinate colorings of $H_q(n,d)$
have no transition edges.
Indeed, consider the coloring based on the coordinates $(i_1,\ldots,i_{n-d+1})$.
Let $(x,y)\in E(H_q(n,d))$, thus $\mbox{\rm wt}(x-y)\geq d$.
Choose a coordinate~$j\in[n]\,\backslash\,\{i_1,\ldots,i_{n-d+1}\}$.
Then at least one of $x+e_j$ and $x+2e_j$ is a neighbor of~$y$ because at least one of them disagrees with~$y$ in the $j$-th coordinate and thus
has at least distance~$d$ from~$y$.
Since both these vertices agree with~$x$ in the positions $i_1,\ldots,i_{n-d+1}$, they have the same color as~$x$.
This shows that $(x,y)$ is not a transition edge.

Furthermore, the even colorings obtained from MDS Hamming codes as described above do not have transition edges either.
This can be shown by a similar argument as in the previous paragraph.
Finally, it is straightforward to verify that the uneven $27$-coloring of $H_3(5,3)$ given above has no transition edges.

Since for the binary Hamming graphs $H_2(n,n-1)$ the coordinate colorings have the maximum possible number of transition edges (that is, maximum robustness), we
conjecture that no $q^{n-d+1}$-coloring of $H_q(n,d),\,q\geq3$, has any transition edges.

We close with the following question which arises from the considerations of maximally robust colorings of $H_2(n,n-1)$.
\begin{que}
Suppose $K$ is a $q^{n-d+1}$-coloring of $H_q(n,d)$ such that its transition space $T(K)$ is generated. Does this imply that~$K$ is even?
\end{que}

\bibliographystyle{abbrv}

Combinatorics (math.CO); Discrete Mathematics (cs.DM); Information Theory (cs.IT)


Existential Closure in Line Graphs

Abstract: A graph $G$ is {\it $n$-existentially closed} if, for all disjoint sets of vertices $A$ and $B$ with $|A\cup B|=n$, there is a vertex $z$ not in $A\cup B$ adjacent to each vertex of $A$ and to no vertex of $B$.In this paper, we investigate $n$-existentially closed line graphs. In particular, we present necessary conditions for the existence of such graphs as well as constructions for finding infinite families of such graphs. We also prove that there are exactly two $2$-existentially closed planar line graphs. We then consider the existential closure of the line graphs of hypergraphs and present constructions for $2$-existentially closed line graphs of hypergraphs.

\section{Introduction}

For a positive integer $n$, a graph is {\it $n$-existentially closed} or simply {\it $n$-e.c.} if, for all disjoint sets of vertices $A$ and $B$ with $|A\cup B|=n$, there is a vertex $z$ not in $A\cup B$ adjacent to each vertex of $A$ and no vertex of $B$.
Hence, for all $n$-subsets $S$ of vertices, there exist $2^n$ vertices joined to $S$ in all possible ways.
For example, a 1-e.c.\ graph is one with neither isolated nor universal vertices.

If a graph has the $n$-e.c.\ property, then it possesses other structural properties such as the following.

\begin{Theorem}\cite{Bon}\label{1}
Fix $n$ a positive integer, and let $G$ be an $n$-e.c.\ graph.

\begin{enumerate}
\item The graph $G$ is $m$-e.c.\ for all $1\leq m\leq n-1$.
\item The graph $G$ has order at least $n+2^n$, and has at least $n2^{n-1}$ edges.
\item The complement graph is $n$-e.c.
\item Each graph of order at most $n+1$ embeds in $G$.
\item If $n>1$, then for each vertex $x$ of $G$, each of the graphs $G-x$, the subgraph induced by the neighbourhood $N(x)$, and the subgraph induced by its complement $N^c(x)$ are $(n-1)$-e.c.
\end{enumerate}
\end{Theorem}

There are exactly three non-isomorphic 1-e.c.\ graphs of order 4: $2K_2$, $C_4$, and $P_4$.
The cartesian product $K_3\square K_3$ is the unique 2-e.c.\ graph of minimum order \cite{BonCam}.

Our main topic will be investigating the $n$-e.c.\ property in line graphs.
Given a graph $G$ with edge set $E(G)$, the {\it line graph} of $G$, denoted $L(G)$, is the graph with vertex set $E(G)$ such that adjacency of vertices in $L(G)$ corresponds with adjacency of edges in $G$, where two edges in $G$ are adjacent if and only if they share at least one end vertex.
We call a graph $G$ {\it $n$-line e.c.}\ if and only if its line graph, $L(G)$, is $n$-e.c.

The only graphs which fail to be 1-line e.c.~are those containing an edge that is adjacent to every other edge and disconnected graphs containing a connected component consisting of a single edge.
For this reason, we will assume all graphs to be connected.
Note that if a graph $G$ has a duplicate edge, then $L(G)$ would have two vertices with the exact same neighbourhood sets and therefore $G$ would not satisfy the 2-line e.c.\ property.
Similarly, if $G$ has a loop, consider any other edge incident with the vertex that has a loop and observe that this scenario would not satisfy the 2-line e.c.\ property.
For these reasons, unless otherwise stated, all graphs we discuss are assumed to be simple.

Some small examples of $n$-line e.c.\ graphs are easy to find.
For example, the graph $C_4$ is the unique 1-line e.c.\ graph of minimum order.
The graph $K_{3,3}$ is the unique 2-line e.c.\ graph on 9 edges since it is the only graph with corresponding line graph $K_3\square K_3$.
Also, the complete graph on at least six vertices and the complete bipartite graph with part sizes at least three are both 2-line e.c.\ graphs.

In this paper, we focus on finding conditions for the existence of $n$-line e.c.\ graphs.
In Section \ref{Res}, we focus on finding necessary conditions for the existence of such graphs and in Section \ref{Cons}, we present constructions which generate infinite families of examples of 2-line e.c.\ graphs.
In Section \ref{Planar}, we prove that there are only two graphs which are both planar and $n$-line e.c.\ for $n\geq 2$.
Lastly, in Section \ref{hyper}, we introduce the problem of existential closure in the line graphs of hypergraphs and present constructions for 2-line e.c.~hypergraphs.

\section{$n$-Line e.c.~Graphs}

When studying a combinatorial object it is often natural to ask what the necessary and sufficient conditions are for such an object to exist.
In this section, we look closely at these conditions in order to ultimately construct more examples of such graphs.

\subsection{Necessary Conditions}\label{Res}

When studying $n$-line e.c.\ graphs, there are some immediate necessary conditions that can be observed from Theorem \ref{1} parts 1 and 2.

\begin{Theorem}\label{2}
Fix $n$ a positive integer. If $G$ is an $n$-line e.c.\ graph, then $G$ is $m$-line e.c.\ for all $1\leq m\leq n-1$ and $G$ has at least $n+2^n$ edges.
\end{Theorem}

The following theorem poses a heavy restriction on the existence of $n$-line e.c.\ graphs.

\begin{Theorem}\label{n=2}
Let $G$ be a graph. If $G$ is $n$-line e.c.\ then $n\leq 2$.
\end{Theorem}

\begin{Proof}
By Theorem \ref{2}, we know that an $n$-line e.c.\ graph is also $m$-line e.c.\ for $1\leq m\leq n$.
So it suffices to show that $G$ cannot be 3-line e.c.

Suppose $G$ is 3-line e.c.\ and let $e_0$ be an edge of $G$.
Since $G$ is also 1-line e.c., there exists an edge $e_1$ not adjacent to $e_0$.
Also, since $G$ is 2-line e.c., there exists an edge $e_2$ not adjacent to $e_0$ or $e_1$.
Finally, since $G$ is 3-line e.c., there must exist a fourth edge, adjacent to each of the previous three distinct edges, no two of which are adjacent.
This is impossible, so $G$ cannot be 3-line e.c.
\end{Proof}

As an alternative proof of Theorem \ref{n=2} consider the following: Suppose $G$ is a 3-line e.c.\ graph, that is, $L(G)$ is a 3-e.c.\ graph.
Note that each graph of order four must occur as an induced subgraph in $L(G)$ by Theorem \ref{1} part 4.
In particular, $L(G)$ must contain $K_{1,3}$ as an induced subgraph, but this is impossible since all line graphs are necessarily claw free \cite{Beineke}.

\subsection{Constructing 2-Line e.c.~Graphs}\label{Cons}

Due to the implication of Theorem \ref{n=2}, our attention will now focus specifically on 2-line e.c.\ graphs. A graph $G$ is 2-line e.c.\ if and only if for each pair of distinct edges $e,f\in E(G)$, there exist edges $a,b,c,d\in E(G)\setminus\{e,f\}$ such that:
\begin{itemize}
\item $a$ is adjacent to both $e$ and $f$,
\item $b$ is adjacent to $e$ and not $f$,
\item $c$ is adjacent to $f$ and not $e$, and
\item $d$ is adjacent to neither $e$ nor $f$.
\end{itemize}
Observe that if $G$ is a 2-line e.c.\ graph, then every matching of size two in $G$ can be embedded in a matching of size three, as well as a path of length three, in $G$ (where a matching is a set of disjoint edges).
Moreover, $G$ has diameter at most three and minimum degree $\delta(G)$ at least two.

With a specific focus on 2-line e.c.\ graphs, we are able to develop some constructions for producing an infinite collection of such graphs.

\begin{Theorem}
\label{cons}
Let $G$ be a 2-line e.c.\ graph. Join to $G$ a new vertex $x$ such that $x$ is adjacent to each vertex of $G$. The resulting graph $G\vee x$ is a 2-line e.c.\ graph.
\end{Theorem}

\begin{Proof}
We must verify that each pair of edges of $G\vee x$ satisfies the 2-line e.c.\ property.
Any two edges of $G$ retain the 2-line e.c.\ property.
For any two edges incident with $x$, say $e=\{u,x\}$ and $f=\{v,x\}$, any third edge incident with $x$ is adjacent to both $e$ and $f$, and any matching of size at least three in $G$ contains at least one edge which is adjacent to neither $e$ nor $f$.
Also, since $\delta(G) \geq 2$, there must be at least one edge incident with $u$ and not $v$, and vice versa.
Therefore there exists at least one edge adjacent to $e$ and not to $f$, and vice versa.

Now let $e=\{u,x\}$ and $f$ be an edge of $G$.
There is an edge adjacent to both since $x$ is adjacent to each vertex of $G$ and there is an edge adjacent to neither since $f$ is a member of a matching in $G$ of size at least three.
In order to find an edge which is adjacent to $f$ and not to $e$, we must consider two scenarios.
First, if $e$ and $f$ are adjacent then observe that $f$ must have an adjacent edge not adjacent to $e$ since $\delta(G) \geq 2$.
Secondly, if $e$ and $f$ are not adjacent then we may freely take any edge adjacent to $f$ and not $e$ unless both end vertices of $f$ (call them $v_1$ and $v_2$) are adjacent to vertex $u$.
In this scenario, observe that the pair of edges $(f,\{v_1,u\})$ must satisfy the 2-line e.c.\ property and so there must be a third edge adjacent to $f$ and not to $\{v_1,u\}$.
Such an edge must be of the form $\{v_2,v\}$ where $v$ is some vertex of $G$ distinct from every other vertex so far.
Now simply observe that the edge $\{v_2,v\}$ serves as an example of an edge adjacent to $f$ and not to $e$.
Finally, finding an edge adjacent to $e$ and not $f$ is easily done since $x$ is adjacent to every vertex of $G$.
\end{Proof}

We can extend this result further to allow the addition of any number of new vertices to a 2-line e.c\ graph.

\begin{Theorem}
\label{cons2}
Let $G$ be a 2-line e.c.\ graph. Join to $G$ a set $S$ of independent vertices of size $|S|\geq 2$ such that each vertex $x\in S$ is adjacent to every vertex of $G$. The resulting graph $G'$ is a 2-line e.c.\ graph.
\end{Theorem}

\begin{Proof}
We must verify that each pair of edges of $G'$ satisfies the 2-line e.c.\ property.
By the proof of Theorem \ref{cons}, the only pairs of edges left to check are pairs of the form $e=\{x_1,u\},f=\{x_2,v\}$ where $x_1,x_2\in S$ and $u,v\in V(G)$.

To find an edge which is adjacent to neither $e$ nor $f$, simply identify a matching of size three in $G$ and observe that $e$ and $f$ can be adjacent to at most two of the edges of the matching.
To find an edge which is adjacent to both, take the edge $\{x_1,v\}$ if $u\neq v$ and any edge incident with $u$ in $G$ if $u=v$.

For an edge that is adjacent to exactly one of $e$ and $f$, we must consider two cases.
If $u\neq v$, observe that there is at most one edge in $G$ which is incident with both $u$ and $v$, and since $\delta(G)\geq 2$, we can easily find an edge adjacent to $e$ and not to $f$ and vice versa.
Otherwise, if $u=v$, take any other distinct vertex in $G$, say $w$, and observe that the edge $\{x_1,w\}$ is adjacent to $e$ but not to $f$ and the edge $\{x_2,w\}$ is adjacent to $f$ but not to $e$.
\end{Proof}

As an immediate corollary of Theorem \ref{cons2} and by our previous observation that $K_{m,n}$ is 2-line e.c.\ for $m,n \geq 3$, we can establish the following.

\begin{Corollary}\label{multi}
Any complete multipartite graph with minimum part size at least three is a 2-line e.c.\ graph.
\end{Corollary}

We can generalise this even further to show that the join of two 2-line e.c.~graphs is itself a 2-line e.c.~graph.

\begin{Theorem}\label{join}
Let $G_1$ and $G_2$ be two 2-line e.c.~graphs each with at least three vertices.
Join $G_1$ to $G_2$ by making every vertex in $G_1$ adjacent to every vertex in $G_2$.
Then the resulting graph $G'=G_1 \vee G_2$ is a 2-line e.c.~graph.
\end{Theorem}

\begin{Proof}
We must verify that each pair of edges of $G'$ satisfies the 2-line e.c.~property.
Any two edges of $G_1$ preserve the 2-line e.c.~property, likewise for $G_2$.
By Corollary \ref{multi}, any two edges of the join have the 2-line e.c.~property as well.

Let $e=\{u,v\}$ be an edge of $G_1$ and $f=\{w,x\}$ be an edge with $w\in V(G_1)$ and $x\in V(G_2)$.
Either $\{u,x\}$ or $\{v,x\}$ serves as an edge which is adjacent to both $e$ and $f$.
Since $e$ is part of a matching of size three in $G_1$, we can find at least one edge which is adjacent to neither $e$ nor $f$.
Note that either $\{u,y\}$ or $\{v,y\}$ is adjacent to $e$ and not $f$ where $y\in V(G_2)$ and $y\neq x$.
Lastly, since $\delta(G_2)\geq 2$, any other edge of $G_2$ incident with $x$ is adjacent to $f$ and not $e$.
Similar arguments verify that the 2-line e.c.~property holds between an edge of $G_2$ and an edge between $G_1$ and $G_2$.

Now let $e=\{u,v\}$ be an edge of $G_1$ and let $f=\{x,y\}$ be an edge of $G_2$.
Let $w\in V(G_1)$ and $z\in V(G_2)$ be additional distinct vertices.
Note that $\{u,x\}$ is adjacent to both $e$ and $f$, and $\{w,z\}$ is adjacent to neither $e$ nor $f$.
Also $\{u,z\}$ is adjacent to $e$ and not $f$, and $\{w,x\}$ is adjacent to $f$ and not $e$.
\end{Proof}

\subsection{2-Line e.c.\ Planar Graphs}\label{Planar}

Recall that for a graph to be 2-line e.c., it necessarily has diameter at most 3.
Small diameter in the context of planar graphs imposes upper bounds on the graph orders in terms of the maximum degree $\Delta$.

\begin{Theorem}\cite{HS}
If $G$ is planar and has diameter 2, then $|V(G)| \leq \lfloor\frac{3\Delta}{2} \rfloor + 1$ when $\Delta \geq 8$.
\end{Theorem}

\begin{Theorem}\cite{FHS}
If $G$ is planar and has diameter 3, then $|V(G)| \leq 8\Delta + 12$.
\end{Theorem}

At the same time, planar graphs cannot have high average degree (a classical application of Euler's Formula shows that the average degree must be below six) and hence they must be relatively sparse.
In terms of diameter, the size of a planar graph is also bounded.

\begin{Theorem}\cite{FMP}
If $G$ is a connected planar graph then $|E(G)| \leq 4|V(G)| -4-3D$, where $D$ denotes the diameter of $G$.
\end{Theorem}

Despite these restrictions, infinite families of planar graphs with small diameter are known to exist, inspiring us to ask whether families of planar 2-line e.c.~graphs exist as well.
However, as we shall see shortly, there are only finitely many such graphs.  In order to address this question, we first establish some necessary conditions for 2-line e.c.~planar graphs.

\begin{Lemma}
Let $G$ be a planar graph. If $G$ is 2-line e.c.\ then every face in any planar embedding of $G$ is a face of size three, that is, $G$ is a triangulation.
\end{Lemma}

\begin{Proof}
Let $G$ be a 2-line e.c.\ planar graph. Now suppose $G$ has a face $F$ where the boundary of $F$ is a 4-cycle $C_F=(a,b,c,d)$ in $G$.

If $F$ has an edge $e$ between any pair of opposite corner vertices say, without loss of generality, between vertices $a$ and $c$, then consider the pair of edges $e$ and $\{a,b\}$.
Since every edge incident with vertex $a$ is also adjacent to $e$, there must exist an edge $f$ incident with vertex $b$ and not incident with $a$ or $c$.
Similarly, if we consider the pair of edges $e$ and $\{a,d\}$, then by the same reasoning, there must exist an edge $g$ incident with vertex $d$ but neither $a$ nor $c$.
Now take $f$ and $g$ as a pair of edges which must satisfy the 2-line e.c.\ property.
Now observe that there cannot exist a third edge adjacent to both $f$ and $g$ since this would be a contradiction to the fact that $G$ is planar and $F$ is a face.

If $F$ has no such edge $e$, then there must be ``pendant" edges at each vertex of $F$ since pairs of adjacent edges along $F$ all need a third edge adjacent to both of them.
Then consider pairs of opposite corner pendant edges and observe that $G$ cannot be both 2-line e.c.\ and planar.

A similar argument can be applied to faces of larger lengths by using the 2-line e.c.\ properties to force a situation that would result in $G$ being non-planar.
So each face in a 2-line e.c.\ planar graph $G$ must be a face of size three and therefore, $G$ is a triangulation.
\end{Proof}

The proof of our next lemma relies heavily on a well known result of Wagner.

\begin{Theorem}\cite{Wag}
A graph $G$ is planar if and only if $G$ contains neither $K_5$ nor $K_{3,3}$ as a graph minor.
\end{Theorem}

\begin{Lemma}
If $G$ is a 2-line e.c.\ planar triangulation then $|V(G)|\leq 16$.
\end{Lemma}

\begin{Proof}
We proceed by examining the possible sizes of matchings in such a graph $G$. It will be useful to observe that in a planar triangulation other than $K_3$, the minimum degree, $\delta$, is at least three.

Let $M$ be a maximum matching in $G$.
Since $G$ is 2-line e.c., each pair of edges of $M$ must have a common neighbouring edge.
So by contracting each edge of $M$, we can observe that $G$ contains $K_{|M|}$ as a minor.
Now if $|M|\geq 5$, then $G$ contains $K_5$ as a minor and is therefore not a planar graph, hence $|M|\leq 4$.

Now since $M$ is maximum, every edge of $E(G)\setminus M$ must share at least one end vertex with an edge of $M$.
Let $V_M$ be the set of end vertices of the edges of $M$. Suppose that for particular vertices $u,v\in V(G)\setminus V_M$, both $u$ and $v$ are adjacent to both end vertices of some edge $\{x,y\}\in M$.
Then we may form a larger matching by taking the union $\{\{x,u\},\{y,v\}\}\cup (M\setminus \{\{x,y\}\})$. But this is a contradiction to the fact that $M$ is a maximum matching.
Therefore, at most one vertex of $V(G)\setminus V_M$ may be adjacent to both end vertices of a particular edge of $M$.
For convenience, we will refer to vertices which satisfy this property as Type 1 vertices and any additional vertices of $V(G)\setminus V_M$ will be referred to as Type 2 vertices.

If $|M|=3$, $G$ may contain at most eleven vertices before it fails to remain planar; six vertices of $V_M$, three Type 1 vertices, and at most two Type 2 vertices.
Indeed, if $G$ has three or more Type 2 vertices, then $G$ must contain a $K_{3,3}$ minor between the vertices of $V_M$ and the Type 2 vertices.

If $|M|=4$, $G$ may contain at most sixteen vertices before it fails to remain planar; eight vertices of $V_M$, four Type 1 vertices, and at most four Type 2 vertices.
Similarly, if $G$ has five or more Type 2 vertices, then $G$ must contain a $K_{3,3}$-minor between the vertices of $V_M$ and the Type 2 vertices.
This is observable by contracting the edges of $M$ to individual vertices and then simply adding Type 2 vertices while keeping in mind that $\delta \geq 3$.
\end{Proof}

By computer search of all planar triangulations up to order 16, we established that there are precisely two 2-line e.c.\ planar graphs, the heptahedral graph 34 and the Johnson solid skeleton 13. These are the two graphs named Tc43 and Tc44, respectively on page 246 of \cite{Atlas}.

\begin{figure}[h]
\begin{minipage}{.5\textwidth}
\centering
\begin{tikzpicture}
\tikzstyle{every node}=[circle, draw, fill=white!75,inner sep=0pt, minimum width=7pt];
\node (v1) at (0,2)[] {};
\node (v2) at (-2,-1.33)[] {};
\node (v3) at (2,-1.33)[] {};
\node (v4) at (0,0.66)[] {};
\node (v5) at (-0.66,0)[] {};
\node (v6) at (0.66,0)[] {};
\node (v7) at (0,-0.66)[] {};

\draw (v1)--(v2);
\draw (v1)--(v3);
\draw (v1)--(v4);
\draw (v1)--(v5);
\draw (v1)--(v6);
\draw (v2)--(v3);
\draw (v2)--(v5);
\draw (v2)--(v7);
\draw (v3)--(v6);
\draw (v3)--(v7);
\draw (v4)--(v5);
\draw (v4)--(v6);
\draw (v5)--(v7);
\draw (v6)--(v7);
\draw (v5)--(v6);

\end{tikzpicture}\caption{heptahedral graph 34}
\end{minipage}\begin{minipage}{.5\textwidth}
\centering
\begin{tikzpicture}
\tikzstyle{every node}=[circle, draw, fill=white!75,inner sep=0pt, minimum width=7pt];
\node (v1) at (0,2)[] {};
\node (v2) at (-2,-1.33)[] {};
\node (v3) at (2,-1.33)[] {};
\node (v4) at (0,0.66)[] {};
\node (v5) at (-0.66,0)[] {};
\node (v6) at (0.66,0)[] {};
\node (v7) at (0,-0.66)[] {};

\draw (v1)--(v2);
\draw (v1)--(v3);
\draw (v1)--(v4);
\draw (v1)--(v5);
\draw (v1)--(v6);
\draw (v2)--(v3);
\draw (v2)--(v5);
\draw (v2)--(v7);
\draw (v3)--(v6);
\draw (v3)--(v7);
\draw (v4)--(v5);
\draw (v4)--(v6);
\draw (v5)--(v7);
\draw (v6)--(v7);
\draw (v4)--(v7);

\end{tikzpicture}\caption{Johnson solid skeleton 13}
\end{minipage}
\end{figure}

This search was aided by the program $\tt{plantri}$, authored by Gunnar Brinkman and Brendan McKay \cite{plantri}.
The heptahedral graphs were first enumerated by Kirkman \cite{kirk} and Hermes \cite{herm} and the Johnson solid skeleton 13 is the planar embedding of the pentagonal bipyramid $J_{1,3}$ \cite{Johnson}.

\section{$n$-Line e.c.~Hypergraphs}\label{hyper}

We know from Theorem \ref{n=2} that a graph cannot be $n$-line e.c.\ for $n\geq 3$. In order to find examples of $n$-e.c.\ line graphs for $n\geq 3$ we must consider the line graphs of hypergraphs.
In fact, the idea of existential closure properties in the line graphs of hypergraphs already has history in the literature, although under a more specific set of parameters.
In particular, the block-intersection graphs of designs (which may be viewed as the line graphs of certain hypergraphs), have been studied with the $n$-existential closure property in mind.
In a 2005 paper by Forbes, Grannell and Griggs \cite{FGG}, the block-intersection graphs of Steiner triple systems are investigated and in a 2007 paper by McKay and Pike \cite{McP}, the block-intersection graphs of more general balanced incomplete block designs were considered.
Existential closure was also examined in the block intersection graphs of infinite designs in \cite{HPS} and \cite{PS}.

A {\it hypergraph} $H$ is a pair $(V,E)$ such that $V$ is a set of distinct vertices and $E$ is a collection of subsets of $V$ called hyperedges or simply edges.
A hypergraph in which all edges have the same cardinality $k$ is called a {\it $k$-uniform hypergraph}.
The {\it line graph} of a hypergraph $H$, denoted $L(H)$, is the graph with vertex set $E(H)$ such that adjacency of vertices in $L(H)$ corresponds with adjacency of edges in $H$, where two edges in $H$ are adjacent if and only if they share at least one vertex.
A matching in a hypergraph is simply a set of edges in which no two edges contain a common vertex and an independent set of vertices in a hypergraph is a set in which no two vertices are contained in a common edge.

\begin{Theorem}
Let $H$ be a hypergraph with edges of size at most $k$. If $H$ is $n$-line e.c.\ then $n\leq k$.
Moreover, if $H$ is a $k$-uniform $n$-line e.c.\ hypergraph, then $n\leq k$.
\end{Theorem}

\begin{Proof}
Suppose $H$ is $(k+1)$-line e.c.\ and let $e$ be an edge of $H$. By the same method as detailed in the proof of Theorem \ref{n=2}, we can build a matching of size $k+1$ in $H$ which contains $e$.

Now, since $H$ is $(k+1)$-line e.c., there must exist a $(k+2)^{\text{nd}}$ edge, adjacent to each of the previous $k+1$ edges, no two of which are adjacent.
This is impossible, so $H$ cannot be $(k+1)$-line e.c.
Finally, in particular, this result holds when $H$ is a $k$-uniform $n$-line e.c.\ hypergraph as well.
\end{Proof}

Note that we can use existing examples of $n$-e.c.~graphs to construct $n$-line e.c.~hypergraphs for any $n$ as follows.
Let $G$ be an $n$-e.c.~graph and form a set of size $\deg(v)$ for each vertex $v\in V(G)$ consisting of the edges with which it is incident.
From this we can build a hypergraph $H$ with $V(H)=E(G)$ and $E(H)$ consisting of the sets we have just formed.
Note that the line graph of $H$ is isomorphic to $G$, so $H$ is an $n$-line e.c.~hypergraph.
Also, if $G$ happens to be $k$-regular, then the resulting hypergraph $H$ would be $k$-uniform.

We can apply this construction to any given set of $n$-e.c.~graphs to produce additional examples of $n$-line e.c.~hypergraphs.
One explicit family of $n$-e.c.~graphs is the set of Paley graphs.
In \cite{BEH} and \cite{BT} it was shown that sufficiently large Paley graphs are $n$-e.c.~for any $n$.
Since Paley graphs are necessarily regular, we conclude that there exist sufficiently large uniform $n$-line e.c.~hypergraphs for any $n$.

If we once again focus on $n=2$, then we can find analogous results for hypergraphs to those presented in Section~\ref{Cons}.

\begin{Theorem}\label{XY}
Let $X$ and $Y$ be disjoint sets of vertices.
Let $H$ be the hypergraph on $X\cup Y$ along with all possible edges of size $k$ such that each edge has a non-empty intersection with both $X$ and $Y$.
If $|X|\geq|Y|\geq 2k-1$, then $H$ is a $k$-uniform 2-line e.c.~hypergraph.
\end{Theorem}

\begin{Proof}
We must verify that each pair of edges in $H$ satisfies the 2-line e.c.~property.
Let $e=\{u_1,u_2,\dots, u_k\}$ and $f=\{v_1,v_2,\dots, v_k\}$ be two edges of $H$.
Without loss of generality we may assume that $u_1,v_1\in X$ and $u_k,v_k\in Y$.

Any third edge which contains $u_1$ and $v_1$ is adjacent to both $e$ and $f$.
Any edge $\{x_1,x_2,\dots,x_k\}$ where each $x_i$ is distinct from each $u_i$ and each $v_i$, is adjacent to neither $e$ nor $f$.
This is possible since $|X|\geq|Y|\geq 2(k-1)+1=2k-1$.
Finally, since $e\neq f$, there exists at least one vertex of $e$ which is not contained in $f$ and vice versa.
So pick this vertex and observe that at least one of its incident edges will serve as an edge which is adjacent to $e$ and not $f$ and vice versa.
\end{Proof}

Using Theorem~\ref{XY} and similar arguments used in the proof of Theorem~\ref{join} we can establish the following corollary.

\begin{Corollary}
Let $H_1$ and $H_2$ be $k$-uniform 2-line e.c.~hypergraphs on distinct sets of vertices.
Let $H$ be the hypergraph $H_1\cup H_2$ along with all possible edges of size $k$ such that each edge has a non-empty intersection with both $V(H_1)$ and $V(H_2)$.
If $|V(H_1)|\geq|V(H_2)|\geq 2k-1$, then $H$ is a $k$-uniform 2-line e.c.~hypergraph.
\end{Corollary}

\section{Acknowledgements}

Authors Burgess and Pike acknowledge NSERC Discovery Grant support and Luther acknowledges NSERC scholarship support.

Existential Closure in Line Graphs