# Expander walk sampling

In the mathematical discipline of graph theory, the expander walk sampling theorem intuitively states that sampling vertices in an expander graph by doing relatively short random walk can simulate sampling the vertices independently from a uniform distribution. The earliest version of this theorem is due to Ajtai, Komlós & Szemerédi (1987), and the more general version is typically attributed to Gillman (1998).

## Statement

Let $G=(V,E)$ be an n-vertex expander graph with positively weighted edges, and let $A\subset V$. Let $P$ denote the stochastic matrix of the graph, and let $\lambda _{2}$ be the second largest eigenvalue of P{\textstyle P}. Let $y_{0},y_{1},\ldots ,y_{k-1}$ denote the vertices encountered in a $(k-1)$-step random walk on $G$ starting at vertex $y_{0}$, and let π(A):={\textstyle \pi (A):=} $\lim _{k\rightarrow \infty }{\frac {1}{k}}\sum _{i=0}^{k-1}\mathbf {1} _{A}(y_{i})$. Where 1$_A$(y){1, if y∈A0, otherwise {\textstyle \mathbf {1} _{A}(y){\begin{cases}1, &{\text{if }}y\in A\\0, &{\text{otherwise }}\end{cases}}}
(It is well known that almost all trajectories $y_{0},y_{1},\ldots ,y_{k-1}$ converges to some limiting point, π(A){\textstyle \pi (A)}, as k→{\textstyle k\rightarrow } ∞{\textstyle \infty }.)
The theorem states that for a weighted graph $G=(V,E)$ and a random walk $y_{0},y_{1},\ldots ,y_{k-1}$ where $y_{0}$ is chosen by an initial distribution q{\textstyle \mathbf {q} }, for all $\gamma >0$, we have the following bound:
    $\Pr \left[{\bigg |}{\frac {1}{k}}\sum _{i=0}^{k-1}\mathbf {1} _{A}(y_{i})-\pi (A){\bigg |}\geq \gamma \right]\leq Ce^{-{\frac {1}{20}}(\gamma ^{2}(1-\lambda _{2})k)}.$
Where $C$ is dependent on $\mathbf {q} ,G$ and $A$.
The theorem gives a bound for the rate of convergence to $\pi (A)$ with respect to the length of the random walk, hence giving a more efficient method to estimate $\pi (A)$ compared to independent sampling the vertices of $G$.

## Proof

In order to prove the theorem, we provide a few definitions followed by three lemmas.
Let ${\it {{w}_{xy}}}$ be the weight of the edge $xy\in E(G)$ and let w$_x$=∑$_{y:xy∈E(G)}$w$_{xy}$.{\textstyle {\it {{w}_{x}=\sum _{y:xy\in E(G)}{\it {{w}_{xy}.}}}}} Denote by π(x):=w$_x$/∑$_{y∈V}$w$_y${\textstyle \pi (x):={\it {{w}_{x}/\sum _{y\in V}{\it {{w}_{y}}}}}}. Let q/√π {\textstyle {\frac {\mathbf {q} }{\sqrt {\pi }}}} be the matrix with entries q(x)/√(π(x)) {\textstyle {\frac {\mathbf {q} (x)}{\sqrt {\pi (x)}}}} , and let N$_{π, q}$=|| q/√π ||$_2${\textstyle N_{\pi , \mathbf {q} }=||{\frac {\mathbf {q} }{\sqrt {\pi }}}||_{2}}.
Let $D={\text{diag}}(1/{\it {{w}_{i})}}$ and $M=({\it {{w}_{ij})}}$. Let P(r)=PE$_r${\textstyle P(r)=PE_{r}} where P{\textstyle P} is the stochastic matrix, E$_r$=diag(e$^{r1A}$){\textstyle E_{r}={\text{diag}}(e^{r\mathbf {1} _{A}})} and r≥0{\textstyle r\geq 0}. Then:
    $P={\sqrt {D}}S{\sqrt {D^{-1}}}\qquad {\text{and}}\qquad P(r)={\sqrt {DE_{r}^{-1}}}S(r){\sqrt {E_{r}D^{-1}}}$
Where $S:={\sqrt {D}}M{\sqrt {D}}{\text{ and }}S(r):={\sqrt {DE_{r}}}M{\sqrt {DE_{r}}}$. As $S$ and $S(r)$ are symmetric, they have real eigenvalues. Therefore, as the eigenvalues of $S(r)$ and $P(r)$ are equal, the eigenvalues of P(r){\textstyle P(r)} are real. Let λ(r){\textstyle \lambda (r)} and λ$_2$(r){\textstyle \lambda _{2}(r)} be the first and second largest eigenvalue of P(r){\textstyle P(r)} respectively.
For convenience of notation, let t$_k$=1/k ∑$_{i=0}$$^{k−1}$1$_A$(y$_i$){\textstyle t_{k}={\frac {1}{k}}\sum _{i=0}^{k-1}\mathbf {1} _{A}(y_{i})}, ϵ=λ−λ$_2${\textstyle \epsilon =\lambda -\lambda _{2}}, ϵ$_r$=λ(r)−λ$_2$(r){\textstyle \epsilon _{r}=\lambda (r)-\lambda _{2}(r)}, and let $\mathbf {1}$ be the all-1 vector.
Lemma 1
$\Pr \left[t_{k}-\pi (A)\geq \gamma \right]\leq e^{-rk(\pi (A)+\gamma )+k\log \lambda (r)}(\mathbf {q} P(r)^{k}\mathbf {1} )/\lambda (r)^{k}$
Proof:
By Markov's inequality,
${\begin{alignedat}{2}\Pr \left[t_{k}\geq \pi (A)+\gamma \right]=\Pr[e^{rt_{k}}\geq e^{rk(\pi (A)+\gamma )}]\leq e^{-rk(\pi (A)+\gamma )}E_{\mathbf {q} }e^{rt_{k}}\end{alignedat}}$
Where $E_{\mathbf {q} }$ is the expectation of $x_{0}$ chosen according to the probability distribution $\mathbf {q}$. As this can be interpreted by summing over all possible trajectories $x_{0},x_{1},...,x_{k}$, hence:
$E_{\mathbf {q} }e^{rt}=\sum _{x_{1},x_{2},...,x_{k}}e^{rt}\mathbb {q} (x_{0})\Pi _{i=1}^{k}p_{x_{i-1}x_{i}}=\mathbf {q} P(r)^{k}\mathbf {1}$
Combining the two results proves the lemma.
Lemma 2
For $0\leq r\leq 1$,
    $(\mathbf {q} P(r)^{k}\mathbf {1} )/\lambda (r)^{k}\leq (1+r)N_{\pi ,\mathbf {q} }$
Proof:
As eigenvalues of $P(r)$ and $S(r)$ are equal,
${\begin{aligned}(\mathbf {q} P(r)^{k}\mathbf {1} )/\lambda (r)^{k}&=(\mathbf {q} P{\sqrt {DE_{r}^{-1}}}S(r)^{k}{\sqrt {D^{-1}E_{r}}}\mathbf {1} )/\lambda (r)^{k}\\&\leq e^{r/2}||{\frac {\mathbf {q} }{\sqrt {\pi }}}||_{2}||S(r)^{k}||_{2}||{\sqrt {\pi }}||_{2}/\lambda (r)^{k}\\&\leq e^{r/2}N_{\pi ,\mathbf {q} }\\&\leq (1+r)N_{\pi ,\mathbf {q} }\qquad \square \end{aligned}}$
Lemma 3
If $r$ is a real number such that $0\leq e^{r}-1\leq \epsilon /4$,
    $\log \lambda (r)\leq r\pi (A)+5r^{2}/\epsilon$
Proof summary:
We Taylor expand log⁡λ(y){\textstyle \log \lambda (y)} about point r=z{\textstyle r=z} to get:
    $\log \lambda (r)=\log \lambda (z)+m_{z}(r-z)+(r-z)^{2}\int _{0}^{1}(1-t)V_{z+(r-z)t}dt$
Where $m_{x}{\text{ and }}V_{x}$ are first and second derivatives of $\log \lambda (r)$ at $r=x$. We show that $m_{0}=\lim _{k\to \infty }t_{k}=\pi (A).$ We then prove that (i) ϵ$_r$≥3ϵ/4{\textstyle \epsilon _{r}\geq 3\epsilon /4} by matrix manipulation, and then prove (ii)$V_{r}\leq 10/\epsilon$ using (i) and Cauchy's estimate from complex analysis.
The results combine to show that
    ${\begin{aligned}\log \lambda (r)=\log \lambda (0)+m_{0}r+r^{2}\int _{0}^{1}(1-t)V_{rt}dt\leq r\pi (A)+5r^{2}/\epsilon \end{aligned}}$
    A line to line proof can be found in Gilman (1998)
Proof of theorem
Combining lemma 2 and lemma 3, we get that
    $\Pr[t_{k}-\pi (A)\geq \gamma ]\leq (1+r)N_{\pi ,\mathbf {q} }e^{-k(r\gamma -5r^{2}/\epsilon )}$
Interpreting the exponent on the right hand side of the inequality as a quadratic in $r$ and minimising the expression, we see that
    $\Pr[t_{k}-\pi (A)\geq \gamma ]\leq (1+\gamma \epsilon /10)N_{\pi ,\mathbf {q} }e^{-k\gamma ^{2}\epsilon /20}$
A similar bound
    $\Pr[t_{k}-\pi (A)\leq -\gamma ]\leq (1+\gamma \epsilon /10)N_{\pi ,\mathbf {q} }e^{-k\gamma ^{2}\epsilon /20}$
holds, hence setting $C=2(1+\gamma \epsilon /10)N_{\pi ,\mathbf {q} }$ gives the desired result.

## Uses

This theorem is useful in randomness reductions in the study of derandomization , showing that expander random walks are good pseudorandom generators against various classes of test functions. Sampling from an expander walk is an example of a randomness-efficient sampler. Note that the number of bits used in sampling $k$ independent samples from $f$ is $k\log n$, whereas if we sample from an infinite family of constant-degree expanders this costs only $\log n+O(k)$. Such families exist and are efficiently constructible, e.g. the Ramanujan graphs of Lubotzky-Phillips-Sarnak.