Comparing the Switch and Curveball Markov Chains for Sampling Binary Matrices with Fixed Marginals

Abstract: The Curveball algorithm is a variation on well-known switch-based Markov chain approaches for uniformly sampling binary matrices with fixed row and column sums. Instead of a switch, the Curveball algorithm performs a so-called binomial trade in every iteration of the algorithm. Intuitively, this could lead to a better convergence rate for reaching the stationary (uniform) distribution in certain cases. Some experimental evidence for this has been given in the literature. In this note we give a spectral gap comparison between two switch-based chains and the Curveball chain. In particular, this comparison allows us to conclude that the Curveball Markov chain is rapidly mixing whenever one of the two switch chains is rapidly mixing. Our analysis directly extends to the case of sampling binary matrices with forbidden entries (under the assumption of irreducibility). This in particular captures the case of sampling simple directed graphs with given degrees. As a by-product of our analysis, we show that the switch Markov chain of the Kannan-Tetali-Vempala conjecture only has non-negative eigenvalues if the sampled binary matrices have at least three columns. This shows that the Markov chain does not have to be made lazy, which is of independent interest. We also obtain an improved bound on the smallest eigenvalue for the switch Markov chain studied by Greenhill for uniformly sampling simple directed regular graphs.

\section{Introduction}
The problem of uniformly sampling binary matrices with fixed row and column sums (marginals) has received a lot of attention, see, e.g., \cite{Rao1996,Kannan1999,Erdos2013,Erdos2015,Erdos2016}.
Equivalent formulations for this problem are the uniform sampling of undirected bipartite graphs, or the uniform sampling of directed graphs with possible a self-loop at every node (but no parallel edges).
One approach is to define a Markov chain on the space of all binary matrices for given fixed row and column sums, and study a random walk on this space induced by making small changes to a matrix using a given probabilisitic procedure (that defines the transition matrix). The idea, roughly speaking, is that after a sufficient amount of time, the so-called \emph{mixing time}, the resulting matrix almost corresponds to a sample from the uniform distribution over all binary matrices with  given row and column sums. The most well-known probabilistic procedures for making these small changes use so-called switches, see, e.g., \cite{Rao1996}.
More recently the Curveball algorithm was introduced in some experimental papers
\cite{Verhelst2008,Strona2014}, which is a procedure that intuitively speeds up the mixing time of switch-based chains in many settings.
The goal of this paper is to confirm this intuition by giving a spectral gap comparison for the Markov chains of the classical switch algorithm of Kannan, Tetali and Vempala \cite{Kannan1999} and the Curveball algorithm as formulated by Verhelst \cite{Verhelst2008}.
We will start with an informal description of both algorithms.

For a given initial binary matrix $A$, in every step of the switch algorithm we randomly choose two distinct rows and two distinct columns uniformly at random. If the $2 \times 2$ submatrix corresponding to these rows and columns is a \emph{checkerboard} $C_i$ for $i = 1,2$, where,
$$
C_1 = \left(\begin{matrix}
1 & 0 \\ 0 & 1
\end{matrix} \right) \ \ \ \ \text{ and }  \ \ \ \
C_2 = \left(\begin{matrix}
0 & 1 \\ 1 & 0
\end{matrix} \right),
$$
then the $2 \times 2$ submatrix is replaced by $C_{i+1}$ for $i$ modulo $2$. That is, if the checkerboard is $C_1$, it is replaced by $C_2$, and vice versa. If the submatrix does not correspond to a checkerboard, nothing is changed. Such an operation is called a \emph{switch}.

The Curveball algorithm intuitively speeds up the switch algorithm. In every step of the algorithm, first two rows are chosen uniformly at random from $A$ as in the switch algorithm. Then, a so-called \emph{binomial trade} is performed. In such a trade, we first look at all the columns in the $2 \times n$ submatrix given by the chosen rows, and we identify all the columns for which the column sum, in this submatrix, is one. That is, the column consist of precisely one $1$ and one $0$. For example if the $2 \times 6$ submatrix (i.e., $n = 6$) is given by
$$
\begin{pmatrix}
1 & \mathbf{1} & 0 & \mathbf{0} & \mathbf{0} & \mathbf{1} \\ 1 & \mathbf{0} & 0 & \mathbf{1} & \mathbf{1} & \mathbf{0}
\end{pmatrix} ,
$$
then we consider the (auxiliary) submatrix
$$
\left(\begin{matrix}
1 & 0 & 0 & 1 \\ 0 & 1 & 1 & 0
\end{matrix} \right)
$$
given by the second, fourth, fifth and sixth column. Let $u$ and $l$ respectively be the number of columns where the $1$ appears on the upper row and the lower row ($u = l = 2$ here)	. We now uniformly at random draw a $2 \times (u+l)$ matrix with columns sums equal to $1$, and row sums equal to $u$ and $l$. Note that there are $\binom{u+l}{u}$ possible choices, hence the name binomial trade. We then replace the (auxiliary) submatrix with this new submatrix in $A$. Note that such a drawing can be obtained by uniformly choosing $u$ out of $u+l$ column indices

Both these algorithms define a Markov chain on the set of all $m \times n$ binary matrices satisfying given row and columns sums $r$ and $c$. The main result of this work is a comparison of their relaxation times, or, equivalently, spectral gaps (see next section for definitions).

\begin{theorem}[Relaxation time comparison]\label{thm:relax_comparison}
Let $(1 - \lambda_*^c)^{-1}$ and $(1 - \lambda_*^s)^{-1}$,  be the relaxation times of the Curveball and switch Markov chains respectively. Then, with $r_{\max}$ the maximum row sum,
$$
\frac{2}{n(n-1)}\cdot (1 - \lambda_*^s)^{-1} \ \leq \ (1 - \lambda_*^c)^{-1} \ \leq \ \min\left\{1, \frac{(2r_{\max} + 1)^2}{2n(n-1)}\right\} \cdot (1 - \lambda_*^s)^{-1}.
$$
\end{theorem}

\noindent We present a more general comparison framework inspired by, and based on, the notion of a heat-bath Markov chain as introduced by Dyer, Greenhill and Ullrich \cite{Dyer2014}. We prove Theorem \ref{thm:relax_comparison} as an application of this framework in the the more general setting where the binary matrices can also have \emph{forbidden entries} that must be zero. This allows us to also compare the chains for the sampling of a simple directed graph with given degree sequence, as its adjacency matrix can be modeled by a square binary matrix with zeros on the diagonal.

\subsection{Related work}
Before going into related work, we would also like to refer the reader to \cite{Erdos2016} for a nice exposition on related work concerning the switch Markov chain.
Kannan, Tetali and Vempala \cite{Kannan1999} conjectured that the KTV-switch chain is rapidly mixing for all fixed row and column sums.
Mikl\' os, Erd\H{o}s  and Soukup \cite{Erdos2013} proved the conjecture for half-regular binary matrices, in which all the row sums are equal (or all column sums), and Erd\H{o}s, Kiss, Mikl\' os and Soukup \cite{Erdos2015}  extended this result to almost half-regular marginals. The authors prove this in a slightly more general context where there might be certain forbidden edge sets.
The Curveball algorithm was first described by Verhelst \cite{Verhelst2008} and a slightly different version was later independently formulated by Strona, Nappo, Boccacci, Fattorini and San-Miguel-Ayanz \cite{Strona2014}. The name Curveball algorithm was introduced in \cite{Strona2014}. Theorem \ref{thm:relax_comparison} directly implies that the Curveball Markov chain is also rapidly mixing for (almost) half-regular marginals.

For the uniform sampling of simple directed graphs with a given degree sequence, the most used switch algorithm is the \emph{edge-switch} version,\footnote{We will address this version as well.} see Greenhill \cite{Greenhill2011}, who gives a polynomial upper bound on the mixing time for the case of $d$-regular directed graphs, and Greenhill and Sfragara \cite{Greenhill2017} for some recent results on certain irregular degree sequences.
The latter paper \cite{Greenhill2017} only considers degree sequences for which the edge-switch Markov chain is irreducible for a given degree sequence. The Curveball chain has also been formulated for (un)directed graphs, see Carstens, Berger and Strona \cite{Carstens2016}. A theoretical analysis for the mixing time of the Curveball Markov chain was raised as an open problem there.

All the results regarding rapid mixing mentioned above rely on the multi-commodity flow method developed by Sinclair \cite{Sinclair1992}. In this work we omit multi-commodity flow techniques in order to compare the switch and Curveball Markov chains, but rather take a more elementary approach based on comparing eigenvalues of transition matrices.
One seeming advantage of the eigenvalue comparison is that it allows us to compare the switch and Curveball chains for arbitrary fixed row and column sums.

Our spectral gap comparisons are special cases of the classical comparison framework developed largely by Diaconis and Saloff-Coste and is based on so-called Dirichlet form comparisons of Markov chains, see, e.g., \cite{Diaconis1993b,Diaconis1993a}, and also Quastel \cite{Quastel1992}.  See also the expository paper by Dyer, Goldberg, Jerrum and Martin \cite{Dyer2006}.  As the stationary distributions are the same for all our Markov chains, we use a more direct, but equivalent, framework based on positive semidefiniteness. We briefly elaborate on this in Appendix \ref{app:dirichlet} for the interested reader.

The transition matrix of the Curveball Markov chain is a special case of a heat-bath Markov chain, as introduced by Dyer, Greenhill and Ullrich \cite{Dyer2014}. Our work partially builds on \cite{Dyer2014} in the sense that we compare a Markov chain, with a similar decomposition property as in the definition of a heat-bath chain, to its heat-bath variant. We explain these ideas in the next section.

\section{General framework}\label{sec:general}
We consider an ergodic Markov chain $\mathcal{M} = (\Omega,P)$ with stationary distribution $\pi$, being strictly positive for all $x \in \Omega$,  that is of the form\footnote{This description is almost the same as that of a heat-bath chain \cite{Dyer2014}, and is introduced to illustrate the conceptual idea.}
\begin{equation}\label{eq:general_chain}
P = \sum_{a \in \mathcal{L}} \rho(a) \sum_{R \in \mathcal{R}_a} P_{R}
\end{equation}
which is given by a
\begin{enumerate}[i)]
\item finite index set $\mathcal{L}$,
and probability distribution $\rho$ over $\mathcal{L}$,
\item partition $\mathcal{R}_a = \cup R_{k,a}$ of $\Omega$ for $a \in \mathcal{L}$.
\end{enumerate}
Moreover, the restriction of a matrix $P_R$ to the rows and columns of $R = R_{k,a}$ defines the transition matrix of an ergodic, time-reversible Markov chain on $R$ (and is zero elsewhere), with stationary distribution
$$
\tilde{\pi}_R(x) = \frac{\pi(x)}{\pi(R)}
$$
for $x \in R$. We use $1 = \lambda_0^R \geq  \lambda_1^R \geq \dots \geq \lambda_{|R|-1}^R$ to denotes its eigenvalues. Note that these are also eigenvalues of $P_R$ and that all other eigenvalues of $P_R$ are zeros (as all rows and columns not corresponding to elements in $R$ only contain zeros). We use $\mathcal{R}$ to denote the multi-set $\cup_a \mathcal{R}_a$ indexed by pairs $(k,a)$.
Note that the chain $\mathcal{M}$ proceeds by drawing an index $a$ from the set $\mathcal{L}$, and then performs a transition in the Markov chain on the set $R$ that the current state is in.

 The \emph{heat-bath variant} $\mathcal{M}_{heat}$ of the chain $\mathcal{M}$ is given by the transition matrix
\begin{equation}\label{eq:heat_chain}
P_{heat} = \sum_{a \in \mathcal{L}} \rho(a) \sum_{R \in \mathcal{R}_a} \mathbf{1}\cdot \sigma_R
\end{equation}
with $\sigma_R$ is a row-vector  given by $\sigma_R(x) = \tilde{\pi}_R(x)$ if $x \in R$ and zero otherwise, and $\mathbf{1}$ the all-ones column vector.
It can be shown that $\mathcal{M}_{heat}$ is an ergodic Markov chain as well. It is reversible by construction \cite{Dyer2014}.\footnote{The Curveball chain is the heat-bath variant of the KTV-switch chain as we will later prove.}

\begin{theorem}\label{thm:heat_comparison}
Let $\mathcal{M}$ be a Markov chain as in (\ref{eq:general_chain}), and $\mathcal{M}_{heat}$ its heat-bath variant as in (\ref{eq:heat_chain}). If $\alpha$ and  $\beta$ are non-zero constants, with $\alpha\cdot \beta > 0$, such that
\begin{equation}
\label{eq:assumption}
\min_{R \in \mathcal{R}} \ \  \min_{i = 1,\dots,R-1} \{ \lambda_i^R, \alpha - \beta(1 - \lambda_i^R) \} \geq 0,
\end{equation}
then
\begin{equation}
\label{eq:alpha_beta}
\frac{1}{\alpha}\frac{1}{1 - \lambda_*^{heat}} \leq \frac{1}{\beta}\frac{1}{1 - \lambda_*},
\end{equation}
where $\lambda_*^{(heat)}$ is the second largest eigenvalue of $P_{(heat)}$. In particular, if $\lambda_{R-1}^R \geq 0$ for every $R \in \mathcal{R}$, then
$
(1 - \lambda_*^{heat})^{-1} \leq (1 - \lambda_*)^{-1}
$.
\end{theorem}

The intuition behind Theorem \ref{thm:heat_comparison} is that in order to compare the relaxation times of a Markov chain and its heat-bath variant, it suffices to compare them locally on the sets $R$. Note that $\alpha$ and $\beta$ can both be negative, so that this statement can  be used to lower bound the relaxation time of the heat-bath variant in terms of the original relaxation time as well.
We will use the following propositions in the proof of Theorem \ref{thm:heat_comparison}. For $S \subseteq \Omega$, the matrix $I_S$ is defined by $I_S(x,x) = 1$ if $x \in S$ and zero otherwise. Also, a symmetric real-valued matrix $A$ is positive semidefinite if all its eigenvalues are non-negative, and this is denoted by $A \succeq 0$.

\begin{proposition}[\cite{Zhang1999}]\label{prop:eigenvalue_comparison}
Let $X,Y$ be symmetric $l \times l$ matrices. If $X - Y \succeq 0$, then $\lambda_i(X) \geq \lambda_i(Y)$ for $i = 1,\dots, l$, where $\lambda_i(C)$ is the $i$-th largest eigenvalue of $C = X,Y$.
\end{proposition}

\begin{proposition}
\label{prop:eigen_difference}
Let $X$ be the $k \times k$ transition matrix of an ergodic reversible Markov chain with stationary distribution $\pi$, and eigenvalues $1 = \lambda_0 > \lambda_1 \geq \dots \geq \lambda_{k-1}$. Let $X^* = \lim_{t \rightarrow \infty} X^t$ be the matrix containing the row vector $\pi$ on every row. Then the eigenvalues of $\alpha(I - X^*) - \beta(I -  X)$ are
$$
\{0\} \cup \{ \alpha - \beta(1 - \lambda_i) \ \big| \  i = 1,\dots,k-1\} .
$$
for given constants $\alpha$ and $\beta$.
\end{proposition}
\begin{proof}
As $X$ is the transition matrix of a reversible Markov chain, it holds that the matrix $V X V^{-1}$ is symmetric, where $V = \text{diag}(\pi_1^{1/2},\pi_2^{1/2},\dots,\pi_k^{1/2}) = \text{diag}(\sqrt{\pi})$.\footnote{This is the same argument for showing that a reversible Markov chain only has real eigenvalues.} Note that the eigenvalues of $\alpha(I - X^*) - \beta(I -  X)$ are the same as those of
$$
V(\alpha(I - X^*) - \beta(I -  X))V^{-1} = \alpha(I - \sqrt{\pi}^T\sqrt{\pi}) - \beta(I - VXV^{-1}).
$$
Moreover, with $1 = (1,1,1,\dots,1)^T$ the all-ones vector, we have
$$
VXV^{-1}\sqrt{\pi}^T = V X \mathbf{1} = V \mathbf{1} = \sqrt{\pi}^T,
$$
so that $\sqrt{\pi}^T$ is an eigenvector of $VXV^{-1}$ with eigenvalue $1$. It then follows that $\sqrt{\pi}^T$ is an eigenvector of $\alpha(I - \sqrt{\pi}^T\sqrt{\pi}) - \beta(I - VXV^{-1})$ with eigenvalue $0$. Let $\sqrt{\pi}^T = w_0, w_1,\dots,w_{k-1}$ be a basis of orthogonal eigenvectors for $VXV^{-1}$ corresponding to eigenvalues $\lambda_1,\dots,\lambda_{k-1}$ (note that $X$ and $VXV^{-1}$ have the same eigenvalues). It then follows that
$$
[\alpha(I - \sqrt{\pi}^T\sqrt{\pi}) - \beta(I - VXV^{-1})] w_i = \alpha - \beta(1 - \lambda_i)
$$
because of orthogonality. This completes the proof.
\end{proof}

\begin{proof}[Proof of Theorem \ref{thm:heat_comparison}]
Let $D$ be the $|\Omega| \times |\Omega|$ diagonal matrix with $(D)_{xx} = \sqrt{\pi(x)}$. As the matrices $\mathbf{1} \cdot \sigma_R$ and $P_R$ define reversible Markov chains on $R$, the matrix
$$
Y_R = D^{-1}[\alpha(I_R - \mathbf{1}\cdot \sigma_R) - \beta(I_R - P_{R})]D
$$
is symmetric. Moreover, from the assumption in (\ref{eq:assumption}), together with Proposition \ref{prop:eigen_difference} and the fact that similar\footnote{Two square matrices $A$ and $B$ are \emph{similar} if there exists an invertible matrix $T$ such that $A = T^{-1}BT$.} matrices have the same set of eigenvalues, it follows that $Y_R$ is positive semidefinite. Since any non-negative linear combination of positive semidefinite matrices is again positive semidefinite, the matrix
$$
D^{-1}[\alpha(I - P_{heat}) - \beta(I - P)]D = \sum_{a \in \mathcal{L}} \rho(a) \sum_{R \in \mathcal{R}_a} D^{-1}[\alpha(I_R - \mathbf{1}\cdot \sigma_R) - \beta(I_R - P_{R})]D
$$
is also positive semidefinite. Using Proposition \ref{prop:eigenvalue_comparison}, and again  the fact that similar matrices $A,B$ have the same set of eigenvalues, it follows that
$$
\alpha(1 - \lambda_i^{heat}) \geq \beta (1 - \lambda_i)
$$
where $\lambda_i^{(heat)}$ is the $i$-th largest eigenvalue of $P_{(heat)}$. Note that $P$ has non-negative eigenvalues as $D^{-1} P D$ is a non-negative linear combination of positive semidefinite matrices. A similar argument holds for $P_{heat}$ and was shown in \cite{Dyer2014}. In particular, it follows that $\lambda_1^{(heat)}$ is the second-largest eigenvalue of $P_{(heat)}$. This proves (\ref{eq:alpha_beta}).
\end{proof}

\subsection{Markov chain definitions} \label{sec:background}
Let $\mathcal{M} = (\Omega,P)$ be an ergodic, time-reversible Markov chain over state space $\Omega$ with transition matrix $P$ and stationary distribution $\pi$. We write $P_x^t = P^t(x,\cdot)$ for the distribution over $\Omega$ at time step $t$ given that the initial state is $x \in \Omega$. It is well-known that the matrix $P$ only has real eigenvalues $1 = \lambda_0 > \lambda_1 \geq \lambda_2 \geq \dots \geq \lambda_{N-1} > -1$, where $N = |\Omega|$. Moreover, we define $\lambda_{*} = \max\{\lambda_1,|\lambda_{N-1}|\}$ is the second-largest eigenvalue of $P$. The \emph{variation distance} at time $t$ with initial state $x$ is
$$
\Delta_x(t) = \max_{S \subseteq \Omega} \big| P^t(x,S) - \pi(s)\big| = \frac{1}{2}\sum_{y \in \Omega} \big| P^t(x,y) - \pi(y)\big|
$$
and the mixing time $\tau(\epsilon)$ is defined as
$$
\tau(\epsilon) = \max_{x \in \Omega}\left\{ \min\{ t : \Delta_x(t') \leq \epsilon \text{ for all } t' \geq t\}\right\}.
$$
A Markov chain is said to be \emph{rapidly mixing} if the mixing time can be upper bounded by a function polynomial in $\ln(|\Omega|/\epsilon)$. It is well-known, e.g., following directly from Proposition 1 \cite{Sinclair1992}, that
\begin{equation}\label{eq:mixing_time}
\frac{1}{2}\frac{\lambda_*}{1 - \lambda_*} \ln(1/2\epsilon) \ \leq \  \tau(\epsilon) \
\leq \ \frac{1}{1 - \lambda_*}\cdot (\ln(1/\pi_*) + \ln(1/\epsilon))
\end{equation}
where $\pi_* = \min_{x \in \Omega} \pi(x)$. This roughly implies that the mixing time is determined  by the \emph{spectral gap} $(1 - \lambda_*)$, or its inverse, the \emph{relaxation time} $(1 - \lambda_*)^{-1}$.

We also introduce some additional notation. We let $G_{\Omega} = (\Omega,A)$ be the state space graph, with an arc $(a,b) \in A$ if and only if $P(a,b) > 0$ for $a,b \in \Omega$ with $a \neq b$. If $P$ is symmetric, we define $H_{\Omega} = (\Omega,E)$ as the undirected counterpart of $G_{\Omega}$ with $\{a,b\} \in E$ if and only if $(a,b),(b,a) \in A$ with $a \neq b$. Moreover, the $\delta$-lazy version of $\mathcal{M}$ is the Markov chain defined by transition matrix $(1 - \delta)I + \delta P$ for $0 < \delta < 1$. Note that this chain is also ergodic, and time-reversible with stationary distribution $\pi$.

\begin{proposition}\label{prop:lazy}
If $0 < \delta < 1$ is such the transition matrix $(1- \delta)I + \delta P$ of the $\delta$-lazy version of $\mathcal{M}$ only has non-negative eigenvalues. Then
$$
\frac{1}{1 - \lambda_{*,\delta}} \leq \frac{1}{\delta} \frac{1}{1 - \lambda_{*}}
$$
 where $\lambda_{*,\delta} = \lambda_{1,\delta} = (1 - \delta) + \delta \lambda_{1}$ is the second-largest eigenvalue of $(1- \delta) + \delta P$.
\end{proposition}
\begin{proof}
If $\lambda_i$ is an eigenvalue of $P$ then $\lambda_{i,\delta} := (1 - \delta) + \delta \lambda_i$ is an eigenvalue of $(1 - \delta)I + \delta P$. Note that $\lambda_i \leq \lambda_j$ if and only if $\delta \lambda_i \leq \delta \lambda_j$, which is true if and only if
$$
\lambda_{i,\delta} = (1 - \delta) + \delta \lambda_i \leq (1 - \delta) + \delta \lambda_j = \lambda_{j,\delta}.
$$
This in particular shows that $\lambda_{1,\delta} =  (1 - \delta) + \delta \lambda_{1}$ is indeed the second-largest eigenvalue of $(1 - \delta)I + \delta P$. Moreover, $\lambda_{i,\delta} = (1 - \delta) + \delta \lambda_i$ is equivalent to
$$
\frac{1}{1 - \lambda_{i,\delta}} = \frac{1}{\delta} \frac{1}{1 - \lambda_{i}}
$$
for $i > 0$. As the eigenvalues of $(1- \delta) + \delta P$ are all non-negative, we have
$$
\frac{1}{1 - \lambda_{*,\delta}} = \frac{1}{1 - \lambda_{1,\delta}} = \frac{1}{\delta} \frac{1}{1 - \lambda_{1}} \leq \frac{1}{\delta} \frac{1}{1 - \lambda_{*}}
$$
and this completes the proof. Note that the final inequality is true independent of the sign of $\lambda_1$.
\end{proof}

\subsection{Johnson graphs.}\label{sec:johnson}

One class of graphs that are of particular interest in this work, are the so-called Johnson graphs.
For given integers $1 \leq q \leq p$, the undirected Johnson graph $J(p,q)$ contains as nodes all subsets of size $q$ of $\{1,\dots,p\}$, and two subsets $u,v \subseteq \{1,\dots,p\}$ are adjacent if and only if $|u \cap v| = q - 1$. We refer the reader to \cite{Holton1993,Brouwer2011} for the following facts. The Johnson graph $J(p,q)$ is a $q(p-q)$-regular graph and the eigenvalues of its adjacency matrix are given by
$$
(q - i)(p - q -i) - i \ \ \ \  \text{ with multiplicity }\ \ \ \   \binom{p}{i} - \binom{p}{i-1}
$$
for $i = 0,\dots,q$, with the convention that $\binom{p}{-1} = 0$. The following observation is included for ease of reference. It will often be used to lower bound the smallest eigenvalue of a Johnson graph.

\begin{proposition}\label{prop:johnson}
Let $p,q \in \mathbb{N}$ be given. The continuous function $f : \mathbb{R} \rightarrow \mathbb{R}$ defined by
$$
f(x) = [(q - x)(p - q - x) - x] - q(p - q) = x(x - (p+1))
$$
is minimized for $x^* = (p+1)/2$ and $f(x^*) = -(p+1)^2/4$.
\end{proposition}

\section{Binary matrices and the switch chain}
We are given $n,m \in \mathbb{N}$, fixed row sums $r = (r_1,\dots, r_m)$, column sums $c = (c_1,\dots,c_n)$, and a set of forbidden entries $\mathcal{F} \subseteq \{1,\dots,m\} \times \{1,\dots,n\}$. The state space $\Omega = \Omega(r,c,\mathcal{F})$ is the set of all binary $m \times n$-matrices $A$ satisfying these row and column sums, and for which $A(a,b) = 0$ if $(a,b) \in \mathcal{F}$. For $A \in \Omega$, we let $A_{ij}$ be the $2 \times n$-submatrix formed by rows $i$ and $j$, for $1 \leq i < j \leq m$. We define
\begin{equation}\label{eq:forbidden_T}
U_{ij}(A) = \{k \in \{1,\dots,n\} : A(i,k) = 1,\ A(j,k) = 0 \text{ and } (j,k) \notin \mathcal{F}\},
\end{equation}
with $u_{ij}(A) = |U_{ij}(A)|$, and similarly
\begin{equation}\label{eq:forbidden_B}
L_{ij}(A) = \{k \in \{1,\dots,n\} : A(i,k) = 0,\ A(j,k) = 1 \text{ and } (i,k) \notin \mathcal{F}\},
\end{equation}
with $l_{ij}(A) = |L_{ij}(A)|$. Note that $L_{ij} \cup U_{ij}$ are precisely the columns $k$ for which $A_{ij}$ has different values on its rows and for which neither $(i,k)$ or $(j,k)$ is forbidden.
Matrices $A, B \in \Omega$ are \emph{switch-adjacent for row $i$ and $j$} if $A = B$ or if $A - B$ contains exactly four non-zero elements that occur on rows $i$ and $j$, and the columns $k$ and $l$ containing these non-zero elements do not have forbidden entries in $A_{ij}$.
Two matrices are switch-adjacent if they are switch-adjacent for some rows $i$ and $j$.

\emph{$\gamma$-Switch chain.} We next introduce the notion of a $\gamma$-switch Markov chain which is done for notational convenience as there are multiple switch-based chains available in the literature. For feasible $\gamma > 0$, the transition matrix of such a chain on state space $\Omega = \Omega(r,c,\mathcal{F})$ is given by
$$
P_{\gamma}(A,B) = \left\{ \begin{array}{ll} \binom{m}{2}^{-1}\cdot \gamma &  \ \ \ \ \ \ \text{if } A \neq B \text{ are switch-adjacent}, \\
\binom{m}{2}^{-1} \sum_{1 \leq i < j \leq m} 1 - u_{ij}l_{ij} \cdot \gamma & \ \ \ \ \ \ \text{if } A = B, \\
0 &\ \ \ \ \ \  \text{otherwise,}
\end{array}\right.
$$
provided $\gamma$ satisfies the following assumption.

\begin{assumption}\label{assump:gamma}
For given $n,m,r,c$ and $\mathcal{F}$, we assume that $\gamma$ is such that
$$
1 - u_{ij}(A)l_{ij}(A)\cdot \gamma > 0
$$
for all $A \in \Omega$ and $1 \leq i < j \leq m$.
\end{assumption}
Note that the transition probability for switch-adjacent matrices is the same everywhere in the state space, and does not depend on the matrices. In particular, the transition matrix $P_{\gamma}$ is symmetric and hence the chain is reversible with respect to the uniform distribution. The factor $2/(m(m-1))$ is included for notational convenience. The chain can roughly be interpreted as follows. We first choose two distinct rows $i$ and $j$ uniformly at random, and then transition to a different matrix switch-adjacent for rows $i$ and $j$, of which there are $u_{ij}l_{ij}$ possibilities, where every matrix has probability $\gamma$ of being chosen;  and with probability $1 - u_{ij}l_{ij}\gamma$ we do nothing. Taking $\gamma = 2/(n(n-1))$ we get back the KTV-switch chain \cite{Kannan1999}. We will later show that  (a lazy version of) the edge-switch chain in \cite{Greenhill2011,Greenhill2017} also falls within this definition. \medskip

\begin{remark}
We always assume that the set $\Omega(r,c,\mathcal{F})$ is non-empty, and that the $\gamma$-switch chain is irreducible (it is clearly always aperiodic and finite).
Irreducibility is in particular guaranteed in the case there are no forbidden entries \cite{Rao1996}; or in case $n = m \geq 4$, with $\mathcal{F}$ is the set of diagonal entries, and regular marginals $c_i = r_i = d$ for some given $d \geq 1$ \cite{Greenhill2011}. Note that the condition of irreducibility is independent of the value of $\gamma$.
\end{remark}\medskip

We next explain that the $\gamma$-switch chain is of the form (\ref{eq:general_chain}). The index set
$$
\mathcal{L} = \{(i,j) : 1 \leq i < j \leq m\}
$$
is the set of all pairs of distinct rows, and $\rho$ is the uniform distribution over $\mathcal{L}$, that is, $\rho(a) =  \binom{m}{2}^{-1}$ for all $a \in \mathcal{L}$. The partitions $\mathcal{R}_a$ for $a \in \mathcal{L}$ rely on the notion of a binomial neighborhood, that is also defined in \cite{Verhelst2008} to describe the Curveball Markov chain (the decomposition idea  given here is novel).

\begin{definition}[Binomial neighborhood]
For a fixed binary matrix $A$ and row-pair $(i,j)$, the $(i,j)$-binomial neighborhood $\mathcal{N}_{ij}(A)$ of $A$ is the set of matrices that can be reached by only applying switches on rows $i$ and $j$. More formally, $N_{ij}(A)$ contains all binary matrices $B \in \Omega$ for which $A(k,l) = B(k,l)$ whenever $(k,l) \notin \{i,j\} \times U_{ij}(A) \cup L_{ij}(A)$, which in particular implies that $U_{ij}(A) \cup L_{ij}(A) = U_{ij}(B) \cup L_{ij}(B)$.\footnote{Said differently, $\mathcal{N}_{ij}(A)$ contains all matrices that can be reached by one trade on rows $i$ and $j$ in the Curveball algorithm, as described in the introduction.}
\end{definition}

It should be clear that two matrices $A, B \in \Omega$ can be part of \emph{at most} one common binomial neighborhood, see also  \cite{Verhelst2008}. This follows directly from the observation that if $B \in \mathcal{N}_{ij}(A) \setminus \{A\}$, then $A$ and $B$ differ on precisely rows $i$ and $j$, so switches using any other pair of rows $\{k,l\} \neq \{i,j\}$ can never transform $A$ into $B$. Moreover, we have $A \in \mathcal{N}_{ij}(A)$;  if $B \in \mathcal{N}_{ij}(A)$, then $A \in \mathcal{N}_{ij}(B)$ \cite{Verhelst2008}; and, if $A \in \mathcal{N}_{ij}(B)$, $B \in \mathcal{N}_{ij}(C)$, then $A \in \mathcal{N}_{ij}(C)$. That is, the relation $\sim_{ij}$ defined by $a \sim b$ if and only if $a \in \mathcal{N}_{ij}(b)$, is an equivalence relation on $\Omega$. The equivalence classes of $\sim_{ij}$ define the set $\mathcal{R}_{(i,j)}$.
Finally, note that $u_{ij}(A) = u_{ij}(B)$ and $l_{ij}(A) = l_{ij}(B)$ if $A$ and $B$ are part of the same binomial neighborhood $\mathcal{N}$. Therefore, these numbers are only neighborhood-dependent, and not element-dependent within a fixed neighborhood. Observe that
$$
|\mathcal{N}| = \binom{u_{ij} + l_{ij}}{u_{ij}}.
$$

Moreover, another important observation is that the undirected state space graph (see Section \ref{sec:background}) $H$ of the $\gamma$-switch chain (which is the same for all $\gamma$) induced on a binomial neighborhood is isomorphic to a Johnson graph $J(u+l,u)$  whenever $u,l \geq 1$ (see Section \ref{sec:johnson} for notation and definition). If either $u = 0$ or $l = 0$ it consists of a single binary matrix. To see this, note that every element in the $(i,j)$-binomial neighborhood $\mathcal{N}_{ij}(A)$ can be represented by the set of indices of the columns $k$ for which $A(i,k) = 1, A(j,k) = 0$ and $(j,k) \notin \mathcal{F}$, which we denote by $Z(A_{ij})$. The set $\{1,\dots,l_{ij} + u_{ij}\}$ here is then the set indices of \emph{all} columns with precisely one $1$ and one $0$ on rows $i,j$ and that do not contain forbidden entries. Indeed, matrices $A \neq B$ are switch-adjacent for rows $i$ and $j$ if $Z(A_{ij}) \cap Z(B_{ij}) = u_{ij} - 1$.
Informally, the Markov chain resulting from always deterministically choosing rows $i$ and $j$ in the switch algorithm, is the disjoint union of smaller Markov chains each with a state space graph isomorphic to some Johnson graph.

\begin{example}\label{exmp:binom_neighborhood}
Consider the binary matrix
$$
A = \left(\begin{matrix}
0 & 1 & 1 & 0 & 1 & 0 & 1\\ 1 & 0 & 0 & 1 & 1 & 0 & 1 \\ 0 & 1 & 0 & 0 & 0 & 1 & 1
\end{matrix} \right)
$$
and the $2 \times 7$-submatrix formed by rows $1$ and $2$, which is
$$
A_{12} = \left(\begin{matrix}
0 & 1 & 1 & 0 & 1 & 0 & 1\\ 1 & 0 & 0 & 1 & 1 & 0 & 1
\end{matrix} \right).
$$
For sake of simplicity, we (uniquely) describe every element of the $(1,2)$-binomial neighborhood $\mathcal{N}_{12}(A)$  by the first four columns (precisely those with column sums equal to one in the submatrix). For the switch chain, the induced subgraph of the undirected state space graph $H$ on the $(1,2)$-binomial neighborhood of $A$, the Johnson graph $J(4,2)$ is given in Figure \ref{fig:johnson}.

\begin{figure}[h!]
\centering
\begin{tikzpicture}[scale=3.75]
\coordinate (A1) at (-0.25,0);
\coordinate (A2) at (0.25,0);
\coordinate (M1) at (-0.5,0.375);
\coordinate (M2) at (0.5,0.375);
\coordinate (T1) at (-0.25,0.75);
\coordinate (T2) at (0.25,0.75);

\node at (A1) [circle,scale=0.7,fill=black] {};
\node (a1) [below=0.1cm of A1]  {$\left(\begin{matrix}
 1 & 0 & 0 & 1 \\ 0 & 1 & 1 & 0
\end{matrix} \right)$};
\node at (A2) [circle,scale=0.7,fill=black] {};
\node (a2) [below=0.1cm of A2]  {$\left(\begin{matrix}
 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 1
\end{matrix} \right)$};
\node at (M1) [circle,scale=0.7,fill=black] {};
\node (m1) [left=0.1cm of M1]  {$\left(\begin{matrix}
 0 & 1 & 1 & 0 \\ 1 & 0 & 0 & 1
\end{matrix} \right)$};
\node at (M2) [circle,scale=0.7,fill=black] {};
\node (m2) [right=0.1cm of M2]  {$\left(\begin{matrix}
 1 & 1 & 0 & 0 \\ 0 & 0 & 1 & 1
\end{matrix} \right)$};
\node at (T1) [circle,scale=0.7,fill=black] {};
\node (t1) [above=0.1cm of T1]  {$\left(\begin{matrix}
 0 & 1 & 0 & 1 \\ 1 & 0 & 1 & 0
\end{matrix} \right)$};
\node at (T2) [circle,scale=0.7,fill=black] {};
\node (t2) [above=0.1cm of T2]  {$\left(\begin{matrix}
 0 & 0 & 1 & 1 \\ 1 & 1 & 0 & 0
\end{matrix} \right)$};

\path[every node/.style={sloped,anchor=south,auto=false}]
(T1) edge[-,very thick] node {} (T2)
(T1) edge[-,very thick] node {} (M2)
(T1) edge[-,very thick] node {} (A1)
(T1) edge[-,very thick] node {} (M1)
(T2) edge[-,very thick] node {} (M1)
(T2) edge[-,very thick] node {} (A1)
(T2) edge[-,very thick] node {} (A2)
(M1) edge[-,very thick] node {} (A2)
(M1) edge[-,very thick] node {} (M2)
(A1) edge[-,very thick] node {} (M2)
(A1) edge[-,very thick] node {} (A2)
(A2) edge[-,very thick] node {} (M2);
\end{tikzpicture}
\quad
\begin{tikzpicture}[scale=3]
\coordinate (A1) at (-0.25,0);
\coordinate (A2) at (0.25,0);
\coordinate (M1) at (-0.5,0.375);
\coordinate (M2) at (0.5,0.375);
\coordinate (T1) at (-0.25,0.75);
\coordinate (T2) at (0.25,0.75);

\node at (A1) [circle,scale=0.7,fill=black] {};
\node (a1) [below=0.1cm of A1]  {$\{1,4\}$};
\node at (A2) [circle,scale=0.7,fill=black] {};
\node (a2) [below=0.1cm of A2]  {$\{1,3\}$};
\node at (M1) [circle,scale=0.7,fill=black] {};
\node (m1) [left=0.1cm of M1]  {$\{2,3\}$};
\node at (M2) [circle,scale=0.7,fill=black] {};
\node (m2) [right=0.1cm of M2]  {$\{1,2\}$};
\node at (T1) [circle,scale=0.7,fill=black] {};
\node (t1) [above=0.1cm of T1]  {$\{2,4\}$};
\node at (T2) [circle,scale=0.7,fill=black] {};
\node (t2) [above=0.1cm of T2]  {$\{3,4\}$};

\path[every node/.style={sloped,anchor=south,auto=false}]
(T1) edge[-,very thick] node {} (T2)
(T1) edge[-,very thick] node {} (M2)
(T1) edge[-,very thick] node {} (A1)
(T1) edge[-,very thick] node {} (M1)
(T2) edge[-,very thick] node {} (M1)
(T2) edge[-,very thick] node {} (A1)
(T2) edge[-,very thick] node {} (A2)
(M1) edge[-,very thick] node {} (A2)
(M1) edge[-,very thick] node {} (M2)
(A1) edge[-,very thick] node {} (M2)
(A1) edge[-,very thick] node {} (A2)
(A2) edge[-,very thick] node {} (M2);
\end{tikzpicture}
\caption{The induced subgraph $H$ for the switch chain on the $(1,2)$-binomial neighborhood of $A$. On the left we have indexed the nodes by the submatrices of the first four columns, and on the right by label sets, indicating the positions of the $1$'s on the top row (i.e., row $1$).}
\label{fig:johnson}
\end{figure}
\end{example}

\begin{remark}
A fixed binomial neighborhood is reminiscient of the Bernoulli-Laplace Diffusion model, see, e.g., \cite{Diaconis1987,Donnelly1994} for an analysis of this model. Here, there are two bins with resp. $k$ and $n- k$ balls,  and in every transition two randomly chosen balls, one from each bin, are interchanged between the bins.  Indeed, the state space graph is then a Johnson graph \cite{Donnelly1994}. The transition probabilities are different, due to the non-zero holding probabilities in the switch algorithm, but the eigenvalues of this Markov chain are related to the eigenvalues of the switch Markov chain on a fixed binomial neighborhood, see also \cite{Diaconis1987,Donnelly1994}
\end{remark}
\medskip

For a binomial neighborhood $\mathcal{N} = \mathcal{N}_{ij}(A)$ for given $i < j$ and $A \in \Omega$, the undirected graph $H_{\mathcal{N}} = (\Omega, E_{\mathcal{N}})$ is the graph where $E_{\mathcal{N}}$ forms the edge-set of the Johnson graph $J(u_{ij} + l_{ij},u_{ij})$ on $\mathcal{N} \subseteq \Omega$, and where all binary matrices $B \in \Omega \setminus \mathcal{N}$ are isolated nodes. We use $M(H_{\mathcal{N}})$ do denote its adjacency matrix. The discussion above leads to the following result summarizing that the $\gamma$-switch chain is of the form (\ref{eq:general_chain}), and that its heat-bath variant is precisely the Curveball Markov chain as in \cite{Verhelst2008} defined by transition matrix
$$
P_c(A,B) = \left\{ \begin{array}{ll} \binom{m}{2}^{-1}\cdot \binom{u_{ij} + l_{ij}}{u_{ij}}^{-1} &  \ \ \ \ \ \ \text{if } B \in \mathcal{N}_{ij}(A) \setminus \{A\}, \\
\binom{m}{2}^{-1}\sum_{1 \leq i < j \leq m}  \binom{u_{ij} + l_{ij}}{u_{ij}}^{-1}  & \ \ \ \ \ \ \text{if } A = B, \\
0 &\ \ \ \ \ \  \text{otherwise.}
\end{array}\right.
$$
Roughly speaking, the Curveball chain is precisely the chain sampling uniform within a fixed binomial neighborhood. For $S \subseteq \Omega$, the identity matrix $I_{S}$ on $S$ is defined by $I_{S}(x,x) = 1$ if $x \in S$ and zero elsewhere, and the all-ones matrix $J_{S}$ on $S$ is defined by $J_S(x,y) = 1$ if $x,y \in S$ and zero elsewhere.

\begin{theorem}\label{thm:switch_decomposition} The transition matrix $P_\gamma$ of the $\gamma$-switch chain is of the form (\ref{eq:general_chain}) namely
\begin{equation}\label{eq:switch_decomposition}
P_\gamma = \sum_{1 \leq i < j \leq m} \binom{m}{2}^{-1} \sum_{\mathcal{N} \in \mathcal{R}_{(i,j)}}  (1 - u_{ij}l_{ij}\cdot\gamma)\cdot I_{\mathcal{N}} + \gamma \cdot M(H_\mathcal{N}).
\end{equation}
The heat-bath variant of the $\gamma$-switch chain  is given by the Curveball chain, and can be written as
\begin{equation}\label{eq:curveball_decomposition}
P_c = \sum_{1 \leq i < j \leq m} \binom{m}{2}^{-1} \sum_{\mathcal{N} \in \mathcal{R}_{(i,j)}}  \binom{u_{ij} + l_{ij}}{u_{ij}}^{-1} J_{\mathcal{N}}.
\end{equation}
\end{theorem}
\begin{proof}
The decomposition in (\ref{eq:switch_decomposition}) follows from the discussion above, and Assumption \ref{assump:gamma} guarantees that the matrix
$$
(1 - u_{ij}l_{ij}\cdot\gamma)\cdot I_{\mathcal{N}} + \gamma \cdot M(H_\mathcal{N})
$$
indeed defines the transition matrix of a Markov chain for every $\mathcal{N}$. Moreover, remember that the $\gamma$-switch chain has uniform stationary distribution $\pi$ over $\Omega$. Indeed, for a binomial neighborhood $\mathcal{N} = \mathcal{N}_{ij}(A)$ for given $i < j$ and $A \in \Omega$, the vector $\sigma_{\mathcal{N}}$ as used in (\ref{eq:heat_chain}) is then given by
$$
\sigma_{\mathcal{N}}(x) = \frac{\pi(x)}{\pi(\mathcal{N})} = \frac{1}{|\Omega|} \cdot \frac{|\Omega|}{|\mathcal{N}|} = \frac{1}{|\mathcal{N}|} = \binom{u_{ij} + l_{ij}}{u_{ij}}^{-1}
$$
if $x \in \mathcal{N}$, and zero otherwise. This implies that
$$
\mathbf{1}\cdot \sigma_{\mathcal{N}} = \binom{u_{ij} + l_{ij}}{u_{ij}}^{-1} J_{\mathcal{N}}.
$$
as desired.
\end{proof}

This completes our description of the $\gamma$-switch chain as a Markov chain of the form (\ref{eq:general_chain}) with heat-bath variant the Curveball chain. We next study two explicit $\gamma$-switch chains.

\subsection{KTV-switch chain}
The switch chain of the Kannan-Tetali-Vempala conjecture, as described in the introduction, can be obtained by setting $\gamma = 2/(n(n-1))$. As the product $u_{ij}(A)l_{ij}(A)$ can be at most $n^2/4$ for any $A \in \Omega$ and $1 \leq i < j \leq m$, we see that $\gamma$ satisfies Assumption \ref{assump:gamma}.

\begin{theorem}\label{thm:curveball_KTV}
Let $P_c$ and $P_{KTV}$ be the transition matrices of resp. the Curveball and KTV-switch Markov chains with $n \geq 3$.
Then
$$
\frac{2}{n(n-1)}\cdot (1 - \lambda_*^{KTV})^{-1} \ \leq \ (1 - \lambda_*^c)^{-1} \ \leq \ \min\left\{1, \frac{(2r_{\max} + 1)^2}{2n(n-1)}\right\} \cdot (1 - \lambda_*^{KTV})^{-1},
$$
where $\lambda_*^{(KTV,c)} = \lambda_1^{(KTV,c)} $ is the second largest eigenvalue of $P_{(KTV,c)}$. In particular, $P_{KTV}$ only has non-negative eigenvalues.
\end{theorem}
\begin{proof}
Let $\mathcal{N} = \mathcal{N}_{ij}(A)$ for given $i < j$ and $A \in \Omega$. We apply Theorem \ref{thm:heat_comparison} for various pairs $(\alpha,\beta)$.

\emph{Case 1: $\alpha = \beta = 1$.} From (\ref{eq:assumption}) it follows that it suffices to show that for any binomial neighborhood $\mathcal{N}$ the submatrix of
$$
Y_{\mathcal{N}} = \left[1 - u_{ij}l_{ij}\cdot\binom{n}{2}^{-1}\right] I_{\mathcal{N}} + \binom{n}{2}^{-1}M(H_{\mathcal{N}})
$$
formed by the rows and columns of $\mathcal{N}$ only has non-negative eigenvalues.
For any eigenvalue $\lambda$ of this submatrix, we  have
$$
\lambda = 1 + (\mu - u_{ij}l_{ij})\binom{n}{2}^{-1}
$$
where $\mu = \mu(\lambda)$ is an eigenvalue of the Johnson graph $J(u_{ij} +l_{ij}, u_{ij})$ on $\mathcal{N}$. In particular, using Proposition \ref{prop:johnson} with $p = u_{ij} + l_{ij}$ and $q = u_{ij}$, we get
$
(\mu - u_{ij}l_{ij}) \geq -\frac{1}{4}(u_{ij} + l_{ij} + 1)^2 \geq -\frac{1}{4}(n + 1)^2
$
using that $0 \leq u_{ij} + l_{ij} \leq n$. Therefore, when $n \geq 5$, we have
$$
\lambda \geq 1 - \frac{1}{2}\frac{(n+1)^2}{n(n-1)} \geq 0.
$$
The cases $n = 3,4$ can be checked with some elementary arguments. This is left to the reader. Note that, in particular, this implies that $P_{KTV}$ only has non-negative eigenvalues when $n \geq  3$.

\emph{Case 2: $\alpha = 1$ and $\beta = (2n(n-1))/((2r_{\max} + 1)^2)$.} Using similar notation as in the previous case,  we show that
$$
\lambda = 1 - \beta \left(1 - \left(1 + \left(\mu - u_{ij} \cdot l_{ij}\right)\binom{n}{2}^{-1}\right)\right) = 1 + \beta(\mu - u_{ij} \cdot l_{ij})\binom{n}{2}^{-1} \geq 0
$$
for any $\mu = \mu(\lambda)$ that is an eigenvalue of the Johnson graph $J(u_{ij} + l_{ij}, u_{ij})$. Again, using Proposition \ref{prop:johnson} in order to lower bound the quantity $(\mu -u_{ij} \cdot l_{ij})$, we find
$$
1 + \beta \cdot \left(\mu -  u_{ij} \cdot l_{ij}\right)\binom{n}{2}^{-1} \geq 1 - \frac{\beta}{4}(u_{ij} + l_{ij} +1)^2\binom{n}{2}^{-1} \geq 1 - \frac{\beta}{4}(2r_{\max}+1)^2\binom{n}{2}^{-1} \geq 0,
$$
using the fact that $0 \leq u_{ij} + l_{ij} \leq 2r_{\max}$ and the choice of $\beta$.

\emph{Case 3: $\alpha = -1$ and $\beta = -2/(n(n-1))$.} We have to show that
$$
\lambda = \binom{n}{2} \left(1 - \left(1 + \left(\mu - u_{ij} \cdot l_{ij}\right)\binom{n}{2}^{-1} \right)\right) - 1 = u_{ij} \cdot l_{ij} - \mu - 1 \geq 0
$$
for all
$$
\mu = \mu(k) = (u - k)(l - k) - k
$$
where $k = 1,\dots,u$. Note that the eigenvalue $u_{ij} \cdot l_{ij}$ for the case $k = 0$ yields the largest eigenvalue $1 = \lambda_0^{\mathcal{N}}$ of $Y_{\mathcal{N}}$, and does not have to be considered here. The maximum over $k = 1,\dots,u$ is then attained for $k = 1$, and we have
$
u_{ij} \cdot l_{ij}- \mu - 1 \geq u_{ij} \cdot l_{ij} - ((u_{ij} - 1)(l_{ij} - 1) - 1) - 1 = u_{ij} + l_{ij} - 1 \geq 0,
$ since $u_{ij}, l_{ij} \geq 1$.
\end{proof}

\subsection{Edge-switch chain}
In every step of the edge-switch algorithm, two matrix-entries $(i,a)$ and $(j,b)$ from the set $\{(c,d) : A(c,d) = 1\}$ are chosen uniformly at random. We refer to it as the edge-switch algorithm, as for the interpretation of uniformly sampling directed graphs (where every node can have at most one self-loop), it corresponds to choosing two distinct edges uniformly at random. If the $2 \times 2$ submatrix corresponding to rows $i,j$ and columns $a,b$ forms a checkerboard, and if $(i,b)$ and $(j,b)$ are not forbidden entries, the checkerboard is adjusted (similar as for the KTV-switch algorithm as described in the introduction). Note that
$$
P_{edge}(A,B) = \binom{\rho}{2}^{-1}
$$
if $A$ and $B$ are switch-adjacent, where $\rho = \sum_{i} r_i$ is the total number of ones in every binary matrix in $\Omega$. Note that
$$
\gamma   =  \binom{m}{2} \binom{\rho}{2}^{-1}
$$
in this case.
The analysis in the main part of this section implies that we can write
\begin{equation}\label{eq:switch_reformulated}
P_{edge} = \sum_{1 \leq i < j \leq m} \binom{m}{2}^{-1} \sum_{\mathcal{N} \in \mathcal{R}_{(i,j)}}  \left[1 - u_{ij}l_{ij}\cdot\binom{m}{2}\binom{\rho}{2}^{-1}\right] I_{\mathcal{N}} + \binom{m}{2}\binom{\rho}{2}^{-1}M(H_{\mathcal{N}})
\end{equation}
where $M(H_{\mathcal{N}})$ is the adjacency matrix of a Johnson graph for every $\mathcal{N}$. However, the matrix
\begin{equation}\label{eq:switch_S}
S_{\mathcal{N}} = \left[1 - u_{ij}l_{ij}\cdot\binom{m}{2}\binom{\rho}{2}^{-1}\right] I_{\mathcal{N}} + \binom{m}{2}\binom{\rho}{2}^{-1}M(H_{\mathcal{N}})
\end{equation}
does not necessarily define the transition matrix of a Markov chain on $\mathcal{N}$, as the holding probabilities might be negative.\footnote{In versions (v1,v2) we wrongfully claim that these matrices are stochastic, from which we conclude that $(1 - \lambda_*^c)^{-1} \leq 2 (1  - \lambda_*^{edge})^{-1}$.
We fix this claim in Theorem \ref{thm:comparison_edge} at the cost of a polynomial factor. We can therefore still conclude that the Curveball chain is rapidly mixing whenever the edge-switch chain is rapidly mixing. The results on regular instances, given later on, remain unchanged.}
We circumvent this problem by making the edge-switch chain $\delta$-lazy for $\delta$ sufficiently small. This procedure can be carried out for any $\gamma$ that does not satisfy Assumption \ref{assump:gamma}, provided $\gamma$ is polynomially bounded.

\begin{theorem}\label{thm:comparison_edge}
There exists a non-negative $\delta = \text{poly}(n,m,\rho)^{-1}$
such that
$$
\frac{1}{1 - \lambda_*^c} \leq  \frac{1}{\delta}\cdot \frac{1}{1 - \lambda_*^{edge}}
$$
where $\lambda_*^{c, (edge)}$ is the second largest eigenvalue of $P_{c, (edge)}$.
\end{theorem}
\begin{proof}
Note that
\begin{eqnarray}
(1 - \delta)I + \delta P_{edge} &=&  \sum_{i < j } \binom{m}{2}^{-1} \sum_{\mathcal{N} \in \mathcal{R}_{(i,j)}} (1 - \delta) + \delta \cdot S_{\mathcal{N}}  \nonumber \\
& = & \sum_{i < j } \binom{m}{2}^{-1} \sum_{\mathcal{N} \in \mathcal{R}_{(i,j)}}  \left[1 - \delta \cdot u_{ij}l_{ij}\binom{m}{2}\binom{\rho}{2}^{-1}\right] I_{\mathcal{N}} + \delta\cdot \binom{m}{2}\binom{\rho}{2}^{-1}M(H_{\mathcal{N}}) \nonumber
\end{eqnarray}
so by taking, e.g.,
$$
\delta = \frac{1}{2}\left[ \frac{n^2}{4}\binom{m}{2}\binom{\rho}{2}^{-1}\right]^{-1}
$$
we see that the matrices $(1 - \delta) + \delta \cdot S_{\mathcal{N}}$ are  stochastic matrices with non-negative eigenvalues, as all holding probabilities are at least $1/2$. Here we also use the fact that $u_{ij}(A)l_{ij}(A) \leq n^2/4$ for all $A \in \Omega$ and $1 \leq i < j \leq m$. We may conclude that $(1 - \lambda_{*}^c)^{-1} \leq (1 - \lambda_{*,\delta}^{edge})^{-1} \leq  (1 - \lambda_{*}^{edge})^{-1}/\delta$ where we use
Proposition \ref{prop:lazy} in the last inequality.
\end{proof}\medskip

For certain instances we can do better than the $\delta$ in the proof of the previous theorem.

\begin{theorem}\label{thm:regular}
Let $\Omega = \Omega(n,d,\mathcal{F})$ be the set of square $n \times n$ binary matrices with row and column sums equal to $d \in \mathbb{N}$, so that $\rho = nd$, and forbidden entries $\mathcal{F}$. Then
$$
(1 - \lambda_*^{c})^{-1} \leq \left(\frac{2d+1}{2d}\right)^2 (1 - \lambda_*^{edge})^{-1}
$$
\end{theorem}
\begin{proof}With $S_{\mathcal{N}}$ as in (\ref{eq:switch_S}) we have that any eigenvalue $\lambda$ of $S_{\mathcal{N}}$ is of the form
$$
\lambda = 1 + (\mu - u_{ij}l_{ij})\binom{n}{2}\binom{nd}{2}^{-1}
$$
where $\mu = \mu(\lambda)$ is an eigenvalue of the Johnson graph $J(u_{ij} + l_{ij},u_{ij})$. Proposition \ref{prop:johnson} shows that
$
(\mu - u_{ij}l_{ij}) \geq -(u_{ij}+ l_{ij} + 1)^2/4 \geq  - (2d + 1)^2/4,
$
using $0 \leq u_{ij} + l_{ij} \leq 2d$ in the last inequality. It then follows that
$$
1 + (\mu - u_{ij}l_{ij})\binom{n}{2}\binom{nd}{2}^{-1} = 1 - \frac{1}{4}\frac{(2d+1)^2n(n-1)}{nd(nd-1)} = 1 - \frac{1}{4}\frac{4d^2(n-1)}{d(nd-1)} - \frac{1}{4}\frac{(4d+1)(n-1)}{d(nd-1)}.
$$
Note that $d(n-1) \leq nd - 1$ for all $n, d \geq 1$, from which it follows that
$$
1 + (\mu - u_{ij}l_{ij})\binom{n}{2}\binom{m}{2}^{-1} \geq - \frac{1}{4}\frac{(4d+1)(n-1)}{d(nd-1)} \geq -\frac{1}{d} - \frac{1}{4d^2}
$$
for all $n \in \mathbb{N}$. This implies that
$(1/d+1/(4d^2))I_{\mathcal{N}} + S_{\mathcal{N}}$ is positive semidefinite. Rescaling, and rewriting, gives that
$$
\left[1 - \left(\frac{2d}{2d+1}\right)^2\right]I_{\mathcal{N}} + \left(\frac{2d}{2d+1}\right)^2 S_{\mathcal{N}}
$$
is a symmetric stochastic transition matrix with only non-negative eigenvalues, i.e., we can take
$$
\delta = \left(\frac{2d}{2d+1}\right)^2.
$$
\end{proof}

\begin{corollary}\label{cor:regular}
Let $\Omega = \Omega(n,d,\mathcal{F})$ be the set of square $n \times n$ binary matrices with row and column sums equal to $d \in \mathbb{N}$, so that $\rho = nd$, and forbidden entries $\mathcal{F}$, and let $\lambda_{|\Omega|-1}^{edge}$ be the smallest eigenvalue of $P_{edge}$. Then
$$
(1 + \lambda_{|\Omega|-1}^{edge})^{-1} \leq \frac{4d^2}{4d^2 - 4d - 1} \leq \frac{5}{2}
$$
if $d \geq 2$.
\end{corollary}
\begin{proof}
In the proof of Theorem \ref{thm:regular} it was shown that
$$
\left( \frac{1}{d} + \frac{1}{4d^2}\right) I + P_{edge} =  \sum_{1 \leq i < j \leq m} \binom{m}{2}^{-1} \sum_{\mathcal{N} \in \mathcal{R}_{(i,j)}}  \left( \frac{1}{d} + \frac{1}{4d^2}\right)I_{\mathcal{N}}  + S_{\mathcal{N}} \succeq 0,
$$
and hence
$
\lambda_{|\Omega|-1}^{edge} \geq -\left( \frac{1}{d} + \frac{1}{4d^2}\right).
$
Rewriting this gives the result.
\end{proof}

With $\mathcal{F}$ the set of diagonal entries, this improves a bound of $(1 + \lambda_{|\Omega|-1}^{edge})^{-1} \leq n^2d^2/4$ of Greenhill \cite{Greenhill2011} for the edge-switch chain for the sampling of simple directed regular graphs.

\section{Parallelism in the Curveball chain}
As a binary matrix is only adjusted on two rows at the time in the Curveball algorithm, one might perform multiple binomial trades in parallel on distinct pairs of rows \cite{Carstens2016}. To be precise, in every step of the so-called \emph{$k$-Curveball algorithm}, we choose a set of $k \leq \lfloor m/2 \rfloor$ disjoint pairs of rows uniformly at random and perform a binomial trade on every pair (see introduction). For $k = \lfloor m/2 \rfloor$ this corresponds to the Global Curveball algorithm described in \cite{Carstens2016}.  We show that the induced $k$-Curveball chain is of the form (\ref{eq:general_chain}). The index set $\mathcal{L} = \mathcal{L}_k$ is the collection of all sets containing $k$ pairwise disjoint sets of two rows, i.e.,
$$
\left\{\{(1_a,1_b),(2_a,2_b),\dots,(k_a,k_b)\} \ : \ 1_a,1_b,\dots,k_a,k_b \in [m], \ |\{1_a,1_b,2_a,2_b,\dots,k_a,k_b\}| = 2k \right\},
$$
and $\rho$ is the uniform distribution over $\mathcal{L}$. For a fixed collection $\kappa \in \mathcal{L}_k$, we define the $\kappa$-neighborhood $\mathcal{N}_{\kappa}(A)$ of binary matrix $A \in \Omega$ as the set of binary matrices $B \in \Omega$ that can be obtained from $A$ by binomial trade-operations (see introduction) only involving the row-pairs in $\kappa$. Formally speaking, we have $B \in \mathcal{N}_{\kappa}(A)$ if and only if there exist binary matrices $A_l$ for $l = 0,\dots,k-1$, so that
$$
A_{l+1} \in \mathcal{N}_{(l+1)_a,(l+1)_b}(A_l)
$$
where $A = A_0$ and $B = A_{k}$. Note that the matrices $A_l$ might not all be pairwise distinct, as $A$ and $B$ could already coincide on certain pairs of rows in $\kappa$. Also note that $u_{i_ai_b}(A) = u_{i_ai_b}(B)$ and $l_{i_ai_b}(A) = l_{i_ai_b}(B)$ if $B \in \mathcal{N}_{\kappa}(A)$ for $i = 1,\dots,k$. It is not hard to see that such a neighborhood is isomorphic to a Cartesian product $W_1 \times W_2 \times \dots \times W_k$ of finite sets $W_1,\dots,W_k$ with
$$
|W_i| = \binom{u_{i_ai_b} + l_{i_ai_b}}{u_{i_ai_b}}.\footnote{That is, the elements of $W_i$ describe a matrix on row-pair $(i_a,i_b)$.}
$$
Moreover, the relation $\sim_{\kappa}$ defined by $a \sim_{\kappa} b$ if and only if $b \in \mathcal{N}_{\kappa}(a)$ defines an equivalence relation, and its equivalence classes give the set $\mathcal{R}_{\kappa}$. We now consider the following artificial formulation of the original Curveball chain: we first select $k$ pairs of distinct rows uniformly at random, and then we choose one of those pairs uniformly at random and apply a binomial trade on that pair. It should be clear that this generates the same Markov chain as when we directly select a pair of distinct rows uniformly at random.
For $\mathcal{N}_{\kappa} \in \mathcal{R}_{\kappa}$ the matrix $P_{\mathcal{N}_{\kappa}}$ restricted to the rows and columns in $\mathcal{N}_{\kappa}$ is then the transition matrix of a Markov chain over $W_1 \times \dots \times W_k$, where in every step we choose an index $i \in [k]$ uniformly at random and make a transition in $W_i$ based on the (uniform) transition matrix
$$
Q_{i} = \binom{u_{i_ai_b} + l_{i_ai_b}}{u_{i_ai_b}} ^{-1} J
$$
where $J$ is the all-ones matrix of approriate size. More formally, the  matrix $P_{\mathcal{N}_{\kappa}}$ restricted to the columns and rows in $\mathcal{N}_{\kappa}$ is given by
\begin{equation}\label{eq:trans_product}
\frac{\sum_{i = 1}^k \left[ \mathbf{\otimes}_{j = 1}^{i-1} \mathcal{I}_j\right] \otimes Q_{i}  \otimes \left[\otimes_{j = i+1}^k \mathcal{I}_j\right]}{k},
\end{equation}
forming a transition matrix on $\mathcal{N}_{\kappa}$, and is zero elsewhere. Here $\mathcal{I}_j$ is the identity matrix with the same size as $Q_j$ and $\otimes$ the usual tensor product. The eigenvalues of the matrix in (\ref{eq:trans_product}) are given by
\begin{equation}\label{eq:eigen_product}
\lambda_{\mathcal{N}_{\kappa}} =  \left\{\frac{1}{k} \sum_{i = 1}^k \lambda_{{j_i},i} : 0 \leq j_i \leq |W_i| - 1\right\}
\end{equation}
where $1= \lambda_{0,i} \geq \lambda_{1,i} \geq \dots \geq \lambda_{|W_i| - 1,i}$ are the eigenvalues of $Q_i$ for $i = 1,\dots,k$.\footnote{See, e.g., \cite{Erdos2015decomposition} for a similar argument regarding the transition matrix, and eigenvalues, of a Markov chain of this form. These statements follow directly from elementary arguments involving tensor products.} It then follows that
$$
P_{c} = \sum_{\kappa \in \mathcal{L}_k} \frac{1}{|\mathcal{L}_k|} \sum_{\mathcal{N}_{\kappa} \in \mathcal{R}_{\kappa}}  P_{\mathcal{N}_{\kappa}}
$$
which is of the form (\ref{eq:general_chain}). For $k = 1$, we get back the description of the previous section. Now, its heat-bath variant is precisely the $k$-Curveball Markov chain
$$
P_{k-Curveball} = \sum_{\kappa \in \mathcal{L}_k} \frac{1}{|\mathcal{L}_k|} \sum_{\mathcal{N}_{\kappa} \in \mathcal{R}_{\kappa}}  \frac{1}{|\mathcal{N}_{\kappa}|} J_{\mathcal{N}_{\kappa}},
$$
where
$$
|\mathcal{N}_{\kappa}| = \prod_{i = 1}^k \binom{u_{i_ai_b} + l_{i_ai_b}}{u_{i_ai_b}}^{-1}
$$
as, roughly speaking, for a fixed neighborhood $\mathcal{N}_{\kappa}$, the $k$-Curveball chain is precisely the uniform sampler over such a neighborhood.

\begin{theorem}\label{thm:global_curveball}
We have
$$
\frac{(1 - \lambda_*^{c})^{-1}}{k} \ \leq \ (1 - \lambda_*^{k,c})^{-1} \ \leq \  (1 - \lambda_*^{c})^{-1}
$$
where $\lambda_*^{k,c}$ is the second-largest eigenvalue of the $k$-Curveball chain, and $\lambda_*^c$ the second-largest eigenvalue of the $1$-Curveball chain.
\end{theorem}
\begin{proof}
The upper bound follows from Theorem \ref{thm:heat_comparison}, with $\alpha = \beta = 1$, as the eigenvalues of all the $Q_i$ are non-negative, and therefore (\ref{eq:eigen_product}) implies that the eigenvalues of the matrix in (\ref{eq:trans_product}) are also non-negative. For the lower bound, we take $\alpha = -1$ and $\beta = -k$. That is, we have to show that
$$
-1 + k(1 - \mu)
$$
with $\mu \in  \lambda_{\mathcal{N}_{\kappa}} \setminus \{1\}$ as in (\ref{eq:eigen_product}). It is not hard to see that the second-largest eigenvalue in $\lambda_{\mathcal{N}_{\kappa}}$ is $(k-1)/k$, as the eigenvalues of every fixed $Q_i$ are $1 = \lambda_{0,i} > \lambda_{1,i} = \dots = \lambda_{|W_i| - 1} = 0$. This implies that
$$
-1 + k(1 - \mu) \geq -1 + k(1 - (k-1)/k) \geq 0
$$
for all $\mu \in  \lambda_{\mathcal{N}_{\kappa}} \setminus \{1\}$.
\end{proof}
In general, the upper bound is tight for certain (degenerate) cases, that is, parallelism in the Curveball chain does not necessarily guarantee an improvement in its relaxation time. E.g., take column marginals $c_i = 1$ for $i = 1,\dots,n$, and row-marginals $r_1 = r_2 = n/2$ and $r_3 = r_4 = 0$, and consider $k = 2$.

\section{Conclusion}
We believe similar ideas as in this work can be used to prove that the Curveball chain is rapidly mixing  for the sampling of undirected graphs with given degree sequences \cite{Carstens2016}, whenever one of the switch chains is rapidly mixing for those marginals. We leave this for future work, as the proof we have in mind is a bit more involved, but of a very similar nature as the ideas described here.
An interesting direction for future work is to give a better comparison between the edge-switch chain and Curveball chain. It would also be interesting to see if there exist classes of marginals for which one can give a strict improvement over the result in Theorem \ref{thm:global_curveball}.

\subsection*{Acknowledgements}
Pieter Kleer is grateful to Annabell Berger and Catherine Greenhill for some useful discussions and comments regarding this work.

 \bibliographystyle{plain}


Coloring Distance Graphs on the Integers

Abstract: Given a set D of positive integers, the associated distance graph on the integers is the graph with the integers as vertices and an edge between distinct vertices if their difference lies in D. We investigate the chromatic numbers of distance graphs. We show that, if $D = {d_1,d_2,d_3,...}$, with $d_n | d_{n+1}$ for all n, then the distance graph has a proper 4-coloring. We further find the exact chromatic numbers of all such distance graphs. Next, we characterize those distance graphs that have periodic proper colorings and show a relationship between the chromatic number and the existence of periodic proper colorings.

\section{Introduction} \label{S:intro}

What is the least number of classes into which the integers
can be partitioned, so that no two members of the same class
differ by a square? What if ``square'' is replaced by ``factorial''?

Questions like these can be formulated as graph coloring problems.
Given a set $D$ of positive integers,
the \emph{distance graph} $\gz{D}$ is the graph with the integers
as vertices and an edge between distinct vertices if
their difference lies in $D$;
we call $D$ the \emph{distance set} of this graph.
A \emph{proper coloring} of a graph is an assignment of colors
to the vertices so that no two vertices joined by an edge
receive the same color.
The \emph{chromatic number} of a graph $G$, denoted by $\chi(G)$,
is the least number of colors in a proper coloring.
We abbreviate $\chi\big(\gz{D}\big)$ by $\ensuremath{\chi(D)}$.
We refer to~\cite{BoMu76,WesD96} for
graph-theoretic terminology not defined here.

When $D$ is the set of all positive squares, we call $\gz{D}$
the \emph{square distance graph}.
When $D$ is the set of all factorials, we obtain the
\emph{factorial distance graph}.
The questions at the beginning of this section ask for
the chromatic numbers of these two graphs.
We will study the chromatic numbers of these and other
distance graphs on the integers.

Distance graphs on the integers were introduced by
Eggleton, Erd{\H o}s, and Skilton in~\cite{EES85}.
In \cite{EES85,EES86}, the problem was posed of
characterizing those distance sets $D$,
containing only primes, such that $\ensuremath{\chi(D)}=4$.
This problem was studied in
\cite{EggR88,EES90,VoWa91,VoWa94};
see also \cite{EES88}.
More recently,
\cite{CCH97,DeZh97} have discussed
the chromatic numbers of more general distance graphs with
distance sets having 3 or 4 elements.

In this paper, we are primarily interested in distance
graphs for which the distance set is infinite,
although our results apply to finite distance sets as well.
We begin in Section~\ref{S:easy}
with some easy lemmas on connectedness and bounds on
the chromatic number.
In Section~\ref{S:dc}, we consider distance graphs for which the
distance set is totally ordered by the divisibility relation.
We determine the chromatic numbers of all such graphs; in particular,
we prove that they are all $4$-colorable.
In Section~\ref{S:pc}, we study periodic proper colorings of
distance graphs and their relationship to the chromatic number.

Throughout this paper
we will use standard notation for intervals to denote
sets of consecutive integers.
For example, $\iv{2}{6}$ denotes the set
$\left\{2,3,4,5,6\right\}$.

\section{Basic Results} \label{S:easy}

In this section, we establish some basic facts about the
connectedness and chromatic number of distance graphs.
The results of this section have all been at least partially
stated in earlier works.

Our first result characterizes those
distance sets for which the distance graph is connected.
This result has been partially stated or implicitly
assumed in a number of earlier works;
see~\cite[p.~95]{EES85}.
For $D$ a set of positive integers,
we note that $\ensuremath{\gcd(D)}$ is well defined when $D$ is
infinite.
Given a real number $k$ and a set $D$, we denote by
$k\cdot D$ the set $\left\{\,kd:d\in D\,\right\}$.

\begin{lemma} \label{L:conn}
Let $D$ be a nonempty set of positive integers.
The graph $\gz{D}$ is connected if
and only if $\ensuremath{\gcd(D)}=1$.
Further, each component of $\gz{D}$ is isomorphic to
$\gzmatch{\frac{1}{\ensuremath{\gcd(D)}}\cdot D}$.
\end{lemma}

\begin{proof}
There is a path between vertices $k$ and $k+1$ if and only if
there exist $d_1,\dotsc,d_a,e_1,\dotsc,e_b\in D$ such that
$d_1+\dotsb+d_a-e_1-\dotsb-e_b=1$. This happens
precisely when $\ensuremath{\gcd(D)}=1$, and so the first
statement of the lemma is true.

For the second statement, one isomorphism is the function\break
$\varphi\colon\ensuremath{\gcd(D)}\cdot\ensuremath{\mathbb{Z}}\to\ensuremath{\mathbb{Z}}$ defined by
$\varphi(k)=\frac{k}{\ensuremath{\gcd(D)}}$.\ggcqed
\end{proof}

When we determine the chromatic numbers of distance graphs,\break
Lemma~\ref{L:conn} will often allow us to assume that the GCD of
the distance set is $1$.

Next, we prove a useful upper bound on the chromatic number.
This result is a slight generalization of a result of
Chen, Chang, and Huang \cite[Lemma~2]{CCH97}.

\begin{lemma} \label{L:nomult}
Let $D$ be a nonempty set of positive integers, and
let $k$ be a positive integer.
If $\frac{1}{\ensuremath{\gcd(D)}}\cdot D$ contains no multiple of $k$,
then $\ensuremath{\chi(D)}\le k$.
\end{lemma}

\begin{proof}
Let $D$ and $k$ be as stated.
By Lemma~\ref{L:conn} we may assume that $\ensuremath{\gcd(D)}=1$.
Thus, we assume that $D$ contains no multiple of $k$.
We color the integers with colors $\iv{0}{k-1}$,
assigning to each integer $i$ the color corresponding
to the residue class of $i$ modulo $k$.
Two integers will be assigned the same color precisely when
they differ by a multiple of $k$.
Since no multiple of $k$ occurs in $D$, this is a proper
$k$-coloring of $\gz{D}$.\ggcqed\end{proof}

The converse of Lemma~\ref{L:nomult} holds when $k=2$.
This gives us a characterization of bipartite
distance graphs:
$\gz{D}$ is bipartite precisely when
$\frac{1}{\ensuremath{\gcd(D)}}\cdot D$ contains no multiple of $2$,
that is, when all elements of $D$ have the same power
of $2$ in their prime factorizations.
This result has been partially stated in earlier works;
see~\cite[Thms.~8 \&~10]{EES85} and~\cite[Thms.~3 \&~4]{CCH97}.

\begin{proposition} \label{P:chi2}
Let $D$ be a set of positive integers.
The graph $\gz{D}$ is bipartite
if and only if there exists a
non-negative integer $k$ so that
$\frac{1}{2^k}\cdot D$ contains only odd integers.
\end{proposition}

\begin{proof}
We may assume $D\ne\emptyset$.
Since a graph is bipartite if and only if each component is
bipartite, we may also assume,
by Lemma~\ref{L:conn}, that $\ensuremath{\gcd(D)}=1$.
For such $D$ we show that $\gz{D}$ is bipartite
if and only if each element of $D$ is odd.

$(\Longrightarrow)$ Since $\ensuremath{\gcd(D)}=1$, $D$ must have
an odd element $d$.
Suppose that $D$ has an even element $e$.
If we begin at $0$, take $e$ steps
in the positive direction,
each of length $d$, ending at $de$, and then take $d$ steps
in the negative direction,
each of length $e$, ending at $0$, then we have followed a closed
walk of odd length.
Formally, the set
\[\left\{0,d,d\cdot2,\dotsc,d(e-1),de,(d-1)e,(d-2)e,\dotsc,2e,e\right\}\]
is the vertex set of an odd circuit, and so $\gz{D}$ is
not bipartite.

$(\Longleftarrow)$
If every element of $D$ is odd, then $\ensuremath{\chi(D)}\le2$,
by Lemma~\ref{L:nomult}.\ggcqed\end{proof}

The converse of Lemma~\ref{L:nomult} does not hold when
$k>2$.
For example, let $k>2$, and let $D=\left\{1,k\right\}$.
Then $\frac{1}{\ensuremath{\gcd(D)}}\cdot D$ contains a multiple of $k$,
and yet $\ensuremath{\chi(D)}\le3\le k$
(this is not hard to show; it will also follow from Lemma~\ref{L:dc3}).
As with general graphs, it appears to be quite difficult to
determine when a distance graph has a proper $k$-coloring, for $k\ge3$.
However, when $D$ is finite, there does exist an algorithm to
determine $\ensuremath{\chi(D)}$.
This was proven for $D$ a finite set of primes
by Eggleton, Erd\H os, and Skilton
\cite[Corollary to Thm.~2]{EES90};
essentially the same proof works for more general sets.

\begin{theorem} \label{T:existsalg}
There exists an algorithm to determine $\ensuremath{\chi(D)}$
for $D$ a finite set of positive integers.\end{theorem}

\begin{proof} (Outline---see~\cite[Thm.~2]{EES90})
Let $q=\max(D)$.
Then $\ensuremath{\chi(D)}\le q+1$, by Lemma~\ref{L:nomult}.
We consider the colorings of the subgraph of $\gz{D}$
induced by $S=\iv{1}{q^q+q}$.
We show that, for $k\le q$, if $S$ has a proper
$k$-coloring, then $\ensuremath{\chi(D)}\le k$;
thus, $\ensuremath{\chi(D)}$ can be determined by a bounded search.

Let $k\le q$, and suppose that $S$ has a proper $k$-coloring.
The number of $k$-colorings of a block of $q$
consecutive integers is at most $q^q$.
Since $S$ contains $q^q+1$ such blocks,
two such blocks contained in $S$
(say $\iv{a}{a+q-1}$ and $\iv{b}{b+q-1}$, with $a<b$)
receive the same pattern of colors.
We extend the coloring of $\iv{a}{b+q-1}$ to a
coloring $f$ of $\ensuremath{\mathbb{Z}}$ using the rule
$f(i+a-b)=f(i)$, for all $i$.
We can show that this is a proper coloring if $\gz{D}$,
and so $\ensuremath{\chi(D)}\le k$.\ggcqed\end{proof}

While an algorithm exists to determine $\ensuremath{\chi(D)}$ for
finite $D$, we do not know whether
there is an efficient algorithm.
For finite graphs, determining whether the chromatic number is
at most $k$ is NP-complete~\cite{GaJo79}.
We conjecture that this is also true for distance graphs
with finite distance sets.

\begin{conjecture} \label{J:3npc}
Let $k\ge3$.
Determining whether $\ensuremath{\chi(D)}\le k$ for finite sets $D$
is NP-complete.\ggcqed\end{conjecture}

\section{Divisibility Chains} \label{S:dc}

We now focus on a particular class of distance graphs:
those in which the distance set is
totally ordered by divisibility.
We show that all such graphs are $4$-colorable,
and we determine their chromatic numbers.

A \emph{divisibility chain} is a set of positive integers that is
totally ordered by the divisibility relation.
When $D$ is a (finite or infinite) divisibility chain we
denote the elements of $D$ by $d_1,d_2,\dotsc$, where
$d_1\mid d_2\mid\dotsb$.
The \emph{ratios} of $D$ are the numbers
$r_i=\frac{d_{i+1}}{d_i}$, for each $i$.
When determining $\ensuremath{\chi(D)}$, we may, by Lemma~\ref{L:conn},
assume that $\ensuremath{\gcd(D)}=d_1=1$.
Thus, $\ensuremath{\chi(D)}$ depends only on the ratios.
We may also assume that all the $d_i$'s are distinct, that is,
that none of the ratios is equal to $1$.

A \emph{string} over $\{1,2\}$ is a finite sequence of $1$'s
and $2$'s, written without spaces or separators.
For example, $\alpha=1211$ is a string of length 4
with $\alpha_1=1$, $\alpha_2=2$, etc.

For $k$ a positive integer, a string $\alpha$
is \emph{$k$-compatible} with a distance set $D$
if there is a proper $k$-coloring of $\gz{D}$ with
colors $\iv{0}{k-1}$ such that the differences, modulo $k$,
between colors of consecutive vertices form
repeated copies of $\alpha$.
Below is part of such a coloring with $k=4$ and $\alpha=1211$.
\newcommand{{}}{{}}
\newcommand{\phantom{0}}{\phantom{0}}
\newcommand{{\,}}{{\,}}
\newcommand{\qp\qp\qs}{\phantom{0}\qp{}}
\newcommand{\qx\qp\qs}{{\,}\phantom{0}{}}
\[
\begin{array}{rl}
\text{vertex}&
  \qx0{} \qp\qp\qs \qp1{} \qp\qp\qs \qp2{} \qp\qp\qs \qp3{} \qp\qp\qs
  \qp4{} \qp\qp\qs \qp5{} \qp\qp\qs \qp6{} \qp\qp\qs \qp7{} \qp\qp\qs
  \qp8{} \qp\qp\qs \qp9{} \qp\qp\qs 10{}   \qp\qp\qs 11{}   \qp\qp\qs
  12{}   \cr
\text{color}&
  \qx0{} \qp\qp\qs \qp1{} \qp\qp\qs \qp3{} \qp\qp\qs \qp0{} \qp\qp\qs
  \qp1{} \qp\qp\qs \qp2{} \qp\qp\qs \qp0{} \qp\qp\qs \qp1{} \qp\qp\qs
  \qp2{} \qp\qp\qs \qp3{} \qp\qp\qs \qp1{} \qp\qp\qs \qp2{} \qp\qp\qs
  \qp3{} \cr
\text{difference}&
  \qx\qp\qs \qp1{} \qp\qp\qs \qp2{} \qp\qp\qs \qp1{} \qp\qp\qs \qp1{}
  \qp\qp\qs \qp1{} \qp\qp\qs \qp2{} \qp\qp\qs \qp1{} \qp\qp\qs \qp1{}
  \qp\qp\qs \qp1{} \qp\qp\qs \qp2{} \qp\qp\qs \qp1{} \qp\qp\qs \qp1{}
  \qp\qp\qs \cr
\end{array}
\]
We see that $1211$ is not $4$-compatible with $\{3\}$,
since, for example, $1$ and $4$ receive the same color;
this is because the sum of three consecutive entries of
the repeated copies of $\alpha$ is divisible
by $4$ (i.e., $2+1+1=4$).
Generally,
a string $\alpha$ is $k$-compatible with $\{d\}$ if the
concatenation of repeated copies of $\alpha$ contains no
$d$ consecutive entries whose sum is a multiple of $k$.

\begin{theorem} \label{T:dc4}
If $D$ is a divisibility chain,
then $\ensuremath{\chi(D)}\le4$.
\end{theorem}

\begin{proof}
We may assume that the $d_i$'s are all distinct, and that $d_1=1$.
We use notation such as $\alpha^n$ to denote a string;
the superscript does not denote exponentiation or concatenation.

\smallskip\noindent\emph{Claim.}
For $n=1,2,3,\dotsc$, there exist strings $\alpha^n$,
$\beta^n$ of length $d_n$ over $\left\{1,2\right\}$ such that
\begin{enumerate}
\item $\alpha^n$, $\beta^n$ differ only in the first entry,
with $\alpha^n_1=1$, and $\beta^n_1=2$, and
  \label{I:dc4pf-differ}
\item if $\gamma$ is a string resulting from the
concatenation of any number of copies of $\alpha^n$ and/or
$\beta^n$, in any order, then $\gamma$ is $4$-compatible with
$\left\{d_1,d_2,d_3,\dotsc,d_n\right\}$.
  \label{I:dc4pf-compat}
\end{enumerate}

Before we prove the claim, we show that the theorem follows from it.
If the claim holds, then, for each $n$,
$\alpha^n$ is $4$-compatible with
$\left\{d_1,d_2,\dotsc,d_n\right\}$, and so
$\gzmatch{\left\{d_1,d_2,\dotsc,d_n\right\}}$
has a proper 4-coloring.
Since every finite subgraph of $\gz{D}$
is isomorphic to a finite subgraph of
$\gzmatch{\left\{d_1,\dotsc,d_n\right\}}$ for some $n$,
every finite subgraph of $\gz{D}$ is 4-colorable,
and we may conclude that $\ensuremath{\chi(D)}\le4$, by a compactness
argument.
Hence, it suffices to prove the claim.

\smallskip\noindent\emph{Proof of Claim.}
We proceed by induction on $n$.
For $n=1$, we assumed that $d_n=1$.
Let $\alpha^n=1$, and let $\beta^n=2$;
these satisfy the claim for $n=1$.

Now suppose that $n\ge1$,
and that the claim holds for $n$.
Define $s$ and $t$ as follows.
\[
s:=\sum_{i=1}^{d_n}\alpha^n_i;\qquad
t:=\sum_{i=1}^{d_n}\beta^n_i=s+1.
\]

We show first that $\iv{r_n\cdot s}{r_n\cdot t}$ contains
integers $w$, $w+1$, neither a multiple of $4$.
If $r_n>2$, then this is true since there are at
least 4 consecutive integers in $\iv{r_n\cdot s}{r_n\cdot t}$.
On the other hand, if $r_n=2$,
then $r_n\cdot s$ and $r_n\cdot t$ are both even.
Exactly one of the two is divisible by four.
If $4\mid\left(r_n\cdot s\right)$, then let $w=r_n\cdot s+1$;
otherwise, let $w=r_n\cdot s$.

Now we choose $a\ge1$, $b\ge0$ so that $a+b=r_n$
and $as+bt=w$:
let $b=w-r_n\cdot s$, and let $a=r_n-b$.
We define $\alpha^{n+1}$ to be the concatenation of
$a$ copies of
$\alpha^n$ followed by $b$ copies of $\beta^n$.
We let
$\beta^{n+1}$ be the concatenation of $\beta^n$
followed by $a-1$ copies of $\alpha^n$ followed by $b$
copies of $\beta^n$;
equivalently,
$\beta^{n+1}$ is $\alpha^{n+1}$ with its first
entry replaced by $2$.

Now, $\alpha^{n+1}$ and $\beta^{n+1}$ both have length $d_{n+1}$,
since $a+b=r_n$, and
$\alpha^{n+1}$ and $\beta^{n+1}$ differ only in the first entry.
Let $\gamma$ be a concatenation of copies of $\alpha^{n+1}$, $\beta^{n+1}$.
Then $\gamma$ is a concatenation of copies of $\alpha^n$ and $\beta^n$,
and so, by the induction hypothesis, $\gamma$ is $4$-compatible
with $\left\{d_1,d_2,\dotsc,d_n\right\}$.

In order to prove that $\alpha^{n+1}$, $\beta^{n+1}$ satisfy the
claim, it remains only to show that $\gamma$ is $4$-compatible
with $\left\{d_{n+1}\right\}$.
This is true if the concatenation of repeated copies of $\gamma$
has no $d_{n+1}$ consecutive entries whose sum is a multiple
of $4$.
Since $\alpha^{n+1}$ and $\beta^{n+1}$ differ in only one entry,
the sum of $d_{n+1}$ consecutive entries of
repeated copies of $\gamma$ is equal either to the sum
of the entries of $\alpha^{n+1}$ or to the sum of the entries
of $\beta^{n+1}$;
that is, it is equal
\begin{align*}
\text{either to}\quad\sum_{i=1}^{d_{n+1}}\alpha^{n+1}_i&=as+bt=w,\\
\text{or to}\quad\sum_{i=1}^{d_{n+1}}\beta^{n+1}_i&=t+(a-1)s+bt=w+1.
\end{align*}
Neither of these is a multiple of $4$.

Thus, the claim is proven.\ggcqed\end{proof}

The bound in Theorem~\ref{T:dc4} is sharp:
if $D=\left\{1,2,6\right\}$,
then the subgraph of $\gz{D}$ induced by
$\iv{1}{7}$ has no proper 3-coloring.
On the other hand, graphs satisfying the hypotheses of
the theorem need not have chromatic number 4, even if
$D$ is infinite.
For example, if $D$ is the set of all powers of $3$, then
every element of $D$ is odd, and so $\ensuremath{\chi(D)}=2$,
by Proposition~\ref{P:chi2}.

\begin{example} \label{G:usedc4}
Let $D=\left\{d_1,d_2,d_3,\dotsc\right\}$, where
$d_i=i!$ for each $i$.
We use the technique of the above proof to produce part of a
proper 4-coloring of $\gz{D}$, the factorial distance graph.

Let $\alpha^1=1$ and $\beta^1=2$.
We find consecutive nonmultiples of 4
in $\iv{2\cdot1}{2\cdot2}=\{2,3,4\}$:
let $w=2$, so that $w+1=3$.
So, $a=2$, and $b=0$.
The string $\alpha^2$ is $2$ copies of $\alpha^1$
followed by $0$ copies of $\beta^1$.
That is, $\alpha^2=11$, and so $\beta^2=21$.

Continuing, we find consecutive nonmultiples of 4
in $\iv{3\cdot2}{3\cdot3}=\{6,7,8,9\}$:
let $w=6$, so that $w+1=7$.
So, $a=3$, and $b=0$.
The string $\alpha^3$ is $3$ copies of $\alpha^2$ followed by
$0$ copies of $\beta^2$.
That is, $\alpha^3=111111$, and so $\beta ^3=211111$.

Once again, we find consecutive nonmultiples of 4
in $\iv{4\cdot6}{4\cdot7}=\iv{24}{28}$:
let $w=25$, so that $w+1=26$.
So, $a=3$, and $b=1$.
The string $\alpha^4$ is $3$ copies of $\alpha^3$ followed
by $1$ copy of $\beta^3$.
That is, $\alpha^4=111111111111111111211111$,
and so $\beta^4=211111111111111111211111$.

The coloring of $\iv{1}{24}$ obtained from $\alpha^4$ is the following.
\[0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,0,1,2,3,0.\ggcenddef\]
\end{example}

In \emph{almost} the entire proof of Theorem~\ref{T:dc4},
``4'' can be replaced by ``3'';
that is, we use $3$-compatibility instead of
$4$-compatibility,
we find a $3$-coloring instead of a $4$-coloring,
and we find consecutive nonmultiples of $3$ instead of $4$.
The one place where $4$ is required is the
argument in the proof showing the existence of
two consecutive nonmultiples when $r_n=2$.
Thus, if we require that $r_n\ne 2$ for each $n$,
then we can replace $4$ by $3$ in the proof, and
we have the following result.

\begin{lemma} \label{L:dc3}
Let $D$ be a divisibility chain, with ratios $r_1,r_2,\dotsc$.
If $r_i\ne2$ for all $i$,
then $\ensuremath{\chi(D)}\le3$.\ggcqed\end{lemma}

Again, the bound in this result is sharp:
if $D=\left\{1,4\right\}$, then the subgraph of $\gz{D}$
induced by $\iv{1}{5}$ has no proper 2-coloring.

We now find $\ensuremath{\chi(D)}$ for every divisibility chain
$D$.

\begin{theorem} \label{T:dcchi}
Let $D$ be a divisibility chain, with ratios $r_1,r_2,\dotsc$.
All of the following hold.
\begin{enumerate}
\item $\ensuremath{\chi(D)}\le4$.
  \label{I:dcchi4}
\item $\ensuremath{\chi(D)}\le3$ if and only if there do not exist
  $i$, $j$ with $i<j$, $r_i=2$, and $3\mid r_j$.
  \label{I:dcchi3}
\item $\ensuremath{\chi(D)}\le2$ if and only if $r_i$ is odd,
  for each $i$.
  \label{I:dcchi2}
\item $\ensuremath{\chi(D)}=1$ if and only if $D=\emptyset$.
  \label{I:dcchi1}
\end{enumerate}
\end{theorem}

\begin{proof}
Statement~\ref{I:dcchi4} follows from Theorem~\ref{T:dc4},
statement~\ref{I:dcchi2} follows from Proposition~\ref{P:chi2},
and statement~\ref{I:dcchi1} holds because a graph is 1-colorable
precisely when it has no edges.
It remains to prove statement~\ref{I:dcchi3}.
We may assume that $d_1=1$.

$(\Longrightarrow)$
Suppose that there exist $i$ and $j$ with $i<j$, $r_i=2$, and $3\mid r_j$.
Then $d_{i+1}=2d_i$, and $d_{j+1}$ is divisible by $3d_i$.
Suppose that $\gz{D}$ has a proper $3$-coloring.
Consider the colors assigned to the multiples of $d_i$.
Since $d_i,2d_i\in D$, vertices $0$, $d_i$, and $2d_i$
induce a complete subgraph and so must be assigned 3 different
colors.
Similarly, $d_i$, $2d_i$, and $3d_i$ must receive 3 different
colors, and so $0$ and $3d_i$ have the same color.
Continuing this argument, all multiples of $3d_i$ must receive the
same color, including $0$ and $d_{j+1}$, which is impossible.

$(\Longleftarrow)$
Suppose there do not exist $i$ and $j$ with the properties
specified in statement~\ref{I:dcchi3};
that is, every ratio divisible by $3$ precedes every ratio equal to
$2$ in the list $\left\{r_1,r_2,\dotsc\right\}$.
If there exist infinitely many ratios that are divisible by $3$,
then, by our assumption, there exists no ratio equal to $2$,
and so $\ensuremath{\chi(D)}\le3$, by Lemma~\ref{L:dc3}.
Thus, we may assume that there are only finitely many
ratios that are divisible by $3$.

Let $c$ be the least positive integer such that
$3\nmid r_i$, for all $i\ge c$.
Then none of $r_1,r_2,\dotsc,r_{c-1}$ is equal to $2$.
Thus, by Lemma~\ref{L:dc3}, the graph
$\gzmatch{\left\{d_1,d_2,\dotsc,d_c\right\}}$
has a proper $3$-coloring.
By the proof of Lemma~\ref{L:dc3}---that is, the proof of
Theorem~\ref{T:dc4}, as modified to prove Lemma~\ref{L:dc3}---there
is a string $\alpha^c$ of length $d_c$
over $\left\{1,2\right\}$ such that
$\alpha^c$ is $3$-compatible with
$\left\{d_1,d_2,\dotsc,d_c\right\}$.

We claim that $\alpha^c$ is $3$-compatible with $D$.
To see this, first note that
\[
\sum_{i=1}^{d_c}\alpha^c_i
\]
is not a multiple of $3$, since $\alpha^c$ is $3$-compatible
with $\left\{d_c\right\}$.
Thus, if integers $x$ and $y$ differ by a multiple of $d_c$,
then, in a $3$-coloring whose differences, modulo $3$,
form repeated copies of $\alpha^c$,
$x$ and $y$ receive the same color
precisely when their difference is a multiple of $3d_c$.
Now, no $r_i$ with $i\ge c$ is divisible by $3$;
thus, no $d_i$ with $i\ge c$ is divisible by $3d_c$.
We conclude that, for each $i\ge c$,
no two integers with difference $d_i$ receive the same color,
and so $\alpha^c$ is $3$-compatible with
$\left\{d_c,d_{c+1},d_{c+2},\dotsc\right\}$.

Thus, $\alpha^c$ is $3$-compatible with $D$, and we have
$\ensuremath{\chi(D)}\le3$.\ggcqed\end{proof}

By Theorem~\ref{T:dcchi}, the chromatic number of
the factorial distance graph is $4$.
We will have more to say about this graph in the next section.

\section{Periodic Colorings} \label{S:pc}

In this section, we consider periodic proper colorings
of distance graphs.
We characterize those distance graphs that have no periodic
proper coloring,
and we find a relationship between
the chromatic number and the nonexistence of periodic proper
colorings.
Periodic colorings have been previously studied in~\cite{EES90}.

\begin{lemma} \label{L:nomultper}
Let $D$ be a set of positive integers, and
let $k$ be a positive integer.
If $D$ contains no multiple of $k$,
then $\gz{D}$
has a periodic proper $k$-coloring.
\end{lemma}

\begin{proof}
We may assume $D\ne\emptyset$.
The proof of Lemma~\ref{L:nomult}
gives a periodic proper $k$-coloring of each component of
$\gz{D}$;
this results in a periodic proper $k$-coloring
of the graph.\ggcqed\end{proof}

We can use Lemma~\ref{L:nomultper} to characterize
those distance graphs that have no periodic proper coloring.
The following result generalizes an observation of
Eggleton~\cite{EggR97}
that the square distance graph has no periodic proper coloring.

\begin{proposition} \label{P:noper}
Let $D$ be a set of positive integers.
The graph $\gz{D}$ has no periodic proper coloring
if and only if $D$ contains a multiple of every positive integer.
\end{proposition}

\begin{proof}
$(\Longrightarrow)$
If there is some positive integer $k$ such
that $D$ contains no multiple of $k$, then,
by Lemma~\ref{L:nomultper},
$\gz{D}$ has a periodic proper coloring.

$(\Longleftarrow)$
Let $D$ contain a multiple of every positive integer.
Let $\gz{D}$ be colored in a periodic manner;
say this coloring has period $k$.
Every pair of vertices whose difference is a multiple
of $k$ will have the same color.
Since $D$ contains some multiple of $k$, this cannot be a
proper coloring.\ggcqed\end{proof}

\begin{remark} \label{R:fact}
It follows from Theorem~\ref{T:dcchi}
that the chromatic number of the factorial distance graph
is $4$.
However, by Proposition~\ref{P:noper}, the factorial
distance graph has no periodic proper coloring.\ggcenddef\end{remark}

Now we examine the effect of the existence of uniquely colorable
subgraphs on proper colorings of distance graphs.
We prove a useful lower bound on the chromatic number
based on uniquely colorable subgraphs and periodic
colorings.

\begin{proposition} \label{P:uniqueper}
Let $D$ be a set of positive integers, and
let $k$ be a positive integer.
If $\gz{D}$ has a finite,
uniquely $k$-colorable subgraph, then
every proper $k$-coloring of $\gz{D}$ is periodic.
\end{proposition}

\begin{proof}
Suppose that $H$ is a uniquely $k$-colorable subgraph of
$\gz{D}$.
We may assume that the least integer that is a vertex of $H$ is $1$.
Let $n$ be the greatest-numbered vertex of $H$.
Since $H$ is uniquely $k$-colorable, every $k$-coloring of
$\iv{1}{n-1}$ that can be extended to a proper $k$-coloring of
$\gz{D}$ has a unique extension to a proper $k$-coloring
of $\iv{1}{n}$.

In short, once we have $k$-colored $\iv{1}{n-1}$, the
color of vertex $n$ is forced.
But, $\iv{2}{n+1}$ also contains a copy of $H$, and so
once we have colored $\iv{2}{n}$, the color of vertex $n+1$
is forced.
By an inductive argument, we can see that $k$-coloring
$\iv{1}{n-1}$ completely determines the coloring of
$\left[1,\infty\right)$.

Essentially the same argument works in the opposite direction:
$k$-coloring $\iv{2}{n}$ forces a certain color to occur
at vertex $1$.
Hence, $k$-coloring any set of $n-1$ consecutive vertices determines
the coloring of all of $\ensuremath{\mathbb{Z}}$.

Now, there are only a finite number of $k$-colorings of $n-1$
consecutive integers.
Since the colorings of blocks of $n-1$ consecutive integers
must eventually repeat, every proper $k$-coloring of the distance
graph is periodic.\ggcqed\end{proof}

Proposition~\ref{P:noper} and Proposition~\ref{P:uniqueper}
have nearly opposite conclusions;
the former concludes that the graph has
no periodic proper coloring,
while
the latter concludes that every proper $k$-coloring of the
distance graph is periodic.
Suppose that a distance graph satisfies the hypothesis of
both propositions, that is,
the distance set contains a multiple of every
positive integer,
and
the graph has a finite, uniquely $k$-colorable subgraph.
Then the conclusions of both propositions must be true:
there is no periodic proper coloring,
and yet
every proper $k$-coloring is periodic.
We can only conclude that the distance graph must have no
proper $k$-coloring at all, and so we have the following result.

\begin{theorem} \label{T:omega+1}
Let $D$ be a set of positive integers, and
let $k$ be a positive integer.
If $D$ contains a multiple of every positive integer,
and $\gz{D}$ has a finite, uniquely $k$-colorable subgraph,
then $\ensuremath{\chi(D)}\ge k+1$.\ggcqed\end{theorem}

We can use Theorem~\ref{T:omega+1} to place a lower bound on
the chromatic number of the square distance graph.
Let $D$ be the set of all positive squares.
Any Pythagorean triple gives a $K_3$ in the square distance graph.
For example, the vertices $0$, $3^2$, $5^2$ induce a $K_3$, since
$3,4,5$ is a Pythagorean triple.
Since $\gz{D}$ has a $K_3$ subgraph,
$\ensuremath{\chi(D)}\ge3$.
Furthermore, $K_3$ is uniquely $3$-colorable, and $D$ contains
a multiple of every positive integer.
Thus, $\ensuremath{\chi(D)}\ge4$, by Theorem~\ref{T:omega+1}.
Eggleton~\cite{EggR97} has found a $K_4$ in the square distance graph:
the vertices are $0$, $672^2$, $680^2$, and $697^2$.
We have $680^2-672^2=104^2$, $697^2-680^2=153^2$, and
$697^2-672^2=185^2$.
Since the square distance graph has a uniquely $4$-colorable
subgraph, we have the following result.

\begin{corollary} \label{C:sqchige5}
The chromatic number of the square distance graph is
at least $5$.\ggcqed\end{corollary}

We do not know whether
the square distance graph contains a $K_5$ or whether its
chromatic number is greater than $5$.

\begin{problem} \label{O:sqchi}
What is the chromatic number of the square distance graph?
Equivalently, what is the least number of classes into
which the integers can be partitioned,
so that no two members of the same class differ by a
square?\ggcqed\end{problem}

It seems likely that no finite number of colors suffices.

We can ask similar questions about the distance graph
resulting when $D$ is the set of all positive $n$th
powers, for $n\ge3$.
We know that these graphs contain no $K_3$
(this is equivalent to ``Fermat's Last Theorem'',
proven by Wiles \cite{WilA95}),
that they do not have periodic proper colorings,
by Proposition~\ref{P:noper},
and that their chromatic numbers are all at least $3$, by
Theorem~\ref{T:omega+1} (or Proposition~\ref{P:chi2}).
It seems likely that these graphs have infinite chromatic
number as well.

As noted in Section~\ref{S:intro},
determining which distance graphs have chromatic number
at most $k$, for a given $k\ge3$, appears to be
difficult.
A similar problem, whose difficultly we cannot estimate
at this time, is the following.

\begin{problem} \label{O:charinf}
Characterize those sets $D$ such that
$\ensuremath{\chi(D)}$ is\break
infinite.\ggcqed
\end{problem}

No coloring requiring an infinite number of colors is periodic.
Thus, by Proposition~\ref{P:noper}, a necessary condition for
such sets $D$ is that they contain a multiple of every integer.
However, this condition is not sufficient, by Remark~\ref{R:fact}.

\section*{Acknowledgments} \label{S:ack}

The author is grateful to Professor Roger Eggleton for bringing
this topic to his attention and for helpful discussions.