# Zig-zag product

In graph theory, the zig-zag product of regular graphs ${\displaystyle G,H}$, denoted by ${\displaystyle G\circ H}$, takes a large graph (${\displaystyle G}$) and a small graph (${\displaystyle H}$), and produces a graph that approximately inherits the size of the large one but the degree of the small one. An important property of the zig-zag product is that if ${\displaystyle H}$ is a good expander, then the expansion of the resulting graph is only slightly worse than the expansion of ${\displaystyle G}$.

Roughly speaking, the zig-zag product ${\displaystyle G\circ H}$ replaces each vertex of ${\displaystyle G}$ with a copy (cloud) of ${\displaystyle H}$, and connects the vertices by moving a small step (zig) inside a cloud, followed by a big step (zag) between two clouds, and finally performs another small step inside the destination cloud.

The zigzag product was introduced by Reingold, Vadhan & Wigderson (2000). When the zig-zag product was first introduced, it was used for the explicit construction of constant degree expanders and extractors. Later on the zig-zag product was used in computational complexity theory to prove that symmetric logspace and logspace are equal (Reingold 2008).

## Definition

Let ${\displaystyle G}$ be a ${\displaystyle D}$-regular graph on ${\displaystyle [N]}$ with rotation map ${\displaystyle \mathrm {Rot} _{G}}$ and let ${\displaystyle H}$ be a ${\displaystyle d}$-regular graph on ${\displaystyle [D]}$ with rotation map ${\displaystyle \mathrm {Rot} _{H}}$. The zig-zag product ${\displaystyle G\circ H}$ is defined to be the ${\displaystyle d^{2}}$-regular graph on ${\displaystyle [N]\times [D]}$ whose rotation map ${\displaystyle \mathrm {Rot} _{G\circ H}}$ is as follows:
${\displaystyle \mathrm {Rot} _{G\circ H}((v,a),(i,j))}$:

1. Let ${\displaystyle (a',i')=\mathrm {Rot} _{H}(a,i)}$.
2. Let ${\displaystyle (w,b')=\mathrm {Rot} _{G}(v,a')}$.
3. Let ${\displaystyle (b,j')=\mathrm {Rot} _{H}(b',j)}$.
4. Output ${\displaystyle ((w,b),(j',i'))}$.

## Properties

### Reduction of the degree

It is immediate from the definition of the zigzag product that it transforms a graph ${\displaystyle G}$ to a new graph which is ${\displaystyle d^{2}}$-regular. Thus if ${\displaystyle G}$ is a significantly larger than ${\displaystyle H}$, the zigzag product will reduce the degree of ${\displaystyle G}$. Roughly speaking, by amplifying each vertex of ${\displaystyle G}$ into a cloud of the size of ${\displaystyle H}$ the product in fact splits the edges of each original vertex between the vertices of the cloud that replace it.

### Spectral gap preservation

The expansion of a graph can be measured by its spectral gap. An important property of the zigzag product is the preservation of the spectral gap. That is, if ${\displaystyle H}$ is a “good enough” expander (has a large spectral gap) then the expansion of the zigzag product is close to the original expansion of ${\displaystyle G}$.

Formally: Define a ${\displaystyle (N,D,\lambda )}$-graph as any ${\displaystyle D}$-regular graph on ${\displaystyle N}$ vertices, whose second largest eigenvalue (of the associated random walk) has absolute value at most ${\displaystyle \lambda }$.

Let ${\displaystyle G_{1}}$ be a ${\displaystyle (N_{1},D_{1},\lambda _{1})}$-graph and ${\displaystyle G_{2}}$ be a ${\displaystyle (D_{1},D_{2},\lambda _{2})}$-graph, then ${\displaystyle G\circ {z}H}$ is a ${\displaystyle (N_{1}\cdot D_{1},D_{2}^{2},f(\lambda _{1},\lambda _{2}))}$-graph, where ${\displaystyle f(\lambda _{1},\lambda _{2})<\lambda _{1}+\lambda _{2}+\lambda _{2}^{2}}$.

### Connectivity preservation

The zigzag product ${\displaystyle G\circ H}$ operates separately on each connected component of ${\displaystyle G}$.

Formally speaking, given two graphs: ${\displaystyle G}$, a ${\displaystyle D}$-regular graph on ${\displaystyle [N]}$ and ${\displaystyle H}$, a ${\displaystyle d}$-regular graph on ${\displaystyle [D]}$ - if ${\displaystyle S\subseteq [N]}$ is a connected component of ${\displaystyle G}$ then ${\displaystyle G|_{S}\circ H=G\circ H|_{S\times D}}$, where ${\displaystyle G|_{S}}$ is the subgraph of ${\displaystyle G}$ induced by ${\displaystyle S}$ (i.e., the graph on ${\displaystyle S}$ which contains all of the edges in ${\displaystyle G}$ between vertices in ${\displaystyle S}$).

## Applications

### Construction of constant degree expanders

In 2002 Omer Reingold, Salil Vadhan, and Avi Wigderson gave a simple, explicit combinatorial construction of constant-degree expander graphs. The construction is iterative, and needs as a basic building block a single, expander of constant size. In each iteration the zigzag product is used in order to generate another graph whose size is increased but its degree and expansion remains unchanged. This process continues, yielding arbitrarily large expanders.

From the properties of the zigzag product mentioned above, we see that the product of a large graph with a small graph, inherits a size similar to the large graph, and degree similar to the small graph, while preserving its expansion properties from both, thus enabling to increase the size of the expander without deleterious effects.

### Solving the undirected s-t connectivity problem in logarithmic space

In 2005 Omer Reingold introduced an algorithm that solves the undirected st-connectivity problem, the problem of testing whether there is a path between two given vertices in an undirected graph, using only logarithmic space. The algorithm relies heavily on the zigzag product.

Roughly speaking, in order to solve the undirected s-t connectivity problem in logarithmic space, the input graph is transformed, using a combination of powering and the zigzag product, into a constant-degree regular graph with a logarithmic diameter. The power product increases the expansion (hence reduces the diameter) at the price of increasing the degree, and the zigzag product is used to reduce the degree while preserving the expansion.