Tutorials › Graph Theory (Undergraduate) › The Hypercube as a Cayley Graph

Automorphisms and Cayley Graphs · Tutorial 686 of 799

The Hypercube as a Cayley Graph

Learn how coordinatewise addition modulo two turns the hypercube into a Cayley graph, and why its generators encode one-coordinate flips.

Advanced 10 min read

What You'll Learn

  • Represent binary strings as elements of a group under coordinatewise addition modulo two.
  • Define the standard generators that flip one coordinate.
  • Prove the hypercube is the Cayley graph of the Boolean group with those generators.
  • Derive the hypercube's degree, connectivity, and edge count from the group description.
  • Relate graph distance to the number of differing coordinates.
  • Avoid confusing the hypercube's generators with all nonzero group elements.

Binary Strings as Group Elements

The hypercube has a simple adjacency rule: two binary strings are adjacent when they differ in exactly one coordinate. A group description turns that rule into a uniform operation: from any string, add one of a fixed set of generators. This makes the hypercube a concrete example of a Cayley graph and connects coordinate changes with algebraic structure.

Fix an integer \(n\ge 0\). Let \(B_n\) be the set of all binary strings of length \(n\), viewed as vectors \(x=(x_1,\ldots,x_n)\) with \(x_i\in\{0,1\}\). Define addition coordinatewise modulo two. Thus \(0+0=0\), \(0+1=1\), \(1+0=1\), and \(1+1=0\) in each coordinate. The identity is the all-zero string \(0^n\), and every element is its own inverse: \(x+x=0^n\). With this operation \(B_n\) is an abelian group, called the Boolean group of order \(2^n\).

For \(1\le i\le n\), let \(e_i\) be the string with a \(1\) in coordinate \(i\) and \(0\) in every other coordinate. Adding \(e_i\) to \(x\) changes exactly its \(i\)th coordinate. The set \(S_n=\{e_1,\ldots,e_n\}\) is the standard generating set. When \(n=0\), the string is empty, \(B_0\) contains just that string, and \(S_0\) is empty.

Definition: For an additive group \(B_n\) and a set \(S\subseteq B_n\setminus\{0^n\}\) satisfying \(-s\in S\) whenever \(s\in S\), its (undirected) Cayley graph has vertex set \(B_n\), with an edge between \(x\) and \(x+s\) for each \(x\in B_n\) and \(s\in S\). Edges are unordered. In \(B_n\), each element is its own inverse, so every subset \(S\) is closed under taking inverses. The hypercube \(Q_n\) is the graph whose vertices are the length-\(n\) binary strings and whose edges join strings differing in exactly one coordinate.

The Hypercube Representation

Theorem: For every \(n\ge 0\), the hypercube \(Q_n\) is the Cayley graph \(\operatorname{Cay}(B_n,S_n)\). In particular, for \(x,y\in B_n\), the vertices \(x\) and \(y\) are adjacent exactly when \(x+y=e_i\) for some \(i\).

Proof. Both graphs have the same vertex set \(B_n\). In the Cayley graph, \(x\) is adjacent to \(y\) exactly when \(y=x+e_i\) for some \(i\). Since \(x+x=0^n\), this is equivalent to \(x+y=e_i\). Adding \(e_i\) flips coordinate \(i\) and leaves every other coordinate unchanged, so this condition holds exactly when \(x\) and \(y\) differ in one coordinate. That is precisely the defining adjacency condition for \(Q_n\). When \(n=0\), there are no generators and no edges, and both graphs consist of the single empty string. Thus the graphs agree for all \(n\ge0\). \(\square\)

The choice of generators matters. Each \(e_i\) describes one allowed move, not an arbitrary change of string. Also, the graph is simple: no generator is \(0^n\), so there are no loops; and if \(x+e_i=x+e_j\), adding \(x\) to both sides gives \(e_i=e_j\), so \(i=j\) and there are no repeated neighbors from different generators.

Worked Example: The Square as a Cayley Graph

Take \(n=2\). Write strings without commas. The vertex set is \(V=\{00,01,10,11\}\), the generators are \(S_2=\{01,10\}\), and the edge set is \(E=\{00\text{--}01,00\text{--}10,01\text{--}11,10\text{--}11\}\). Here \(a\text{--}b\) denotes the undirected edge with endpoints \(a\) and \(b\).

Starting at \(00\), adding \(01\) gives \(01\) and adding \(10\) gives \(10\). From \(01\), the two additions give \(00\) and \(11\), since \(01+01=00\) and \(01+10=11\). From \(10\), they give \(11\) and \(00\); from \(11\), they give \(10\) and \(01\). These are exactly the four listed edges, each joining strings that differ in one coordinate.

Check: Each of the four vertices has degree \(2\), so the sum of degrees is \(4\cdot2=8\). Each edge contributes \(2\) to that sum, giving \(8/2=4\) edges, as in the edge list. The graph is the 4-cycle \(00,01,11,10,00\).

Consequences of the Generator Description

For \(n\ge1\), the standard generators are distinct, and adding \(e_i\) to a fixed vertex gives a different neighbor for each \(i\). Hence every vertex has degree \(n\), so \(Q_n\) is \(n\)-regular. Each string is a sum of the standard generators: \(x=\sum_{i:x_i=1}e_i\). Consequently, one can reach any vertex \(x\) from \(0^n\) by adding the generators corresponding to its \(1\)-coordinates. The graph is connected; for \(n=0\), it is connected as a single-vertex graph.

The number of vertices is \(2^n\), since each of the \(n\) coordinates has two choices. For \(n\ge1\), the handshake lemma says that the sum of the degrees is twice the number of edges. Applying it to this \(n\)-regular graph gives the edge count below. The exceptional case \(n=0\) has no edges.

$$ |V(Q_n)|=2^n,\qquad \deg(x)=n,\qquad |E(Q_n)|=\frac{n2^n}{2}=n2^{n-1}\quad(n\ge1). $$

The algebra also describes distance. Define the Hamming weight \(\operatorname{wt}(z)\) to be the number of coordinates of \(z\) equal to \(1\). The Hamming distance between \(x\) and \(y\) is \(\operatorname{wt}(x+y)\), because a coordinate of \(x+y\) is \(1\) exactly where \(x\) and \(y\) differ.

Theorem: In \(Q_n\), the graph distance between \(x\) and \(y\) is \(\operatorname{wt}(x+y)\).

Proof. Let \(k=\operatorname{wt}(x+y)\). The strings differ in exactly \(k\) coordinates. Flipping each of those coordinates once gives a path from \(x\) to \(y\) of length \(k\), so their graph distance is at most \(k\). Conversely, each edge flips exactly one coordinate. To get from \(x\) to \(y\), each of the \(k\) differing coordinates must be flipped an odd number of times, and therefore at least once. Any such path has length at least \(k\). The two inequalities give distance \(k\). If \(x=y\), then \(k=0\), and the length-zero path gives the same conclusion. \(\square\)

Worked Example: The Cube and Its Edge Count

For \(n=3\), the vertex set is \(V=\{000,001,010,011,100,101,110,111\}\). The edge set, obtained by flipping one of the three coordinates, is \(E=\{000\text{--}001,000\text{--}010,000\text{--}100,001\text{--}011,001\text{--}101,010\text{--}011,010\text{--}110,100\text{--}101,100\text{--}110,011\text{--}111,101\text{--}111,110\text{--}111\}\).

For example, the neighbors of \(101\) are found by flipping each coordinate in turn: \(101+100=001\), \(101+010=111\), and \(101+001=100\). Thus its degree is \(3\). The same three distinct flips are available at every vertex, so the total degree sum is \(8\cdot3=24\), giving \(24/2=12\) edges by the handshake lemma.

Check: The displayed edge set contains \(12\) edges. Independently, the formula gives \(n2^{n-1}=3\cdot2^2=12\). The count from the degree sum and the count from the formula agree with the explicit list.

Worked Example: Distance in a Four-Dimensional Hypercube

Let \(Q_4\) have vertex set \(V=\{0,1\}^4\), and edge set consisting of every unordered pair of strings that differ in exactly one coordinate. Consider \(x=1011\) and \(y=0101\). Their sum is computed coordinatewise modulo two: \(1011+0101=1110\). This string has three \(1\)-coordinates, so the Hamming distance is \(3\).

Flip the first coordinate of \(1011\) to get \(0011\); flip the second to get \(0111\); then flip the third to get \(0101\). This gives the path \(1011,0011,0111,0101\), of length \(3\). Any path between the endpoints must flip each of the first three coordinates an odd number of times, so it must have at least three edges. Therefore the graph distance is exactly \(3\).

Check: The sum \(1110\) has \(1+1+1+0=3\) ones, and the displayed path has three edges. Both computations confirm the distance formula.

Why the Boolean Group Is the Right One

The group operation records the effect of coordinate changes without requiring separate rules for every starting vertex. Adding the same generator at any vertex performs the same coordinate flip. Moreover, adding a string \(a\) to every vertex preserves adjacency: if \(y=x+e_i\), then \(y+a=(x+a)+e_i\). Thus translations \(x\mapsto x+a\) preserve the hypercube's edges. This illustrates how the Cayley graph description exposes symmetries through the group operation.

There is a useful distinction between the generating set and the group itself. The group \(B_n\) contains all \(2^n\) strings, but the standard generating set contains only the \(n\) strings with exactly one \(1\). A move in the graph adds one generator, not any group element. Several moves may combine to add a string with multiple \(1\)-coordinates.

Common Pitfall: Using Too Many Generators

For \(n=2\), an incorrect choice would be \(S=\{01,10,11\}\), the set of all nonzero elements of \(B_2\). This makes \(00\) adjacent to \(11\), since \(00+11=11\in S\). But \(00\) and \(11\) differ in two coordinates, so that edge is not in the square \(Q_2\). The correct generating set is only \(\{01,10\}\): \(11\) is reached from \(00\) by two moves, because \(00+01=01\) and \(01+10=11\). Including \(11\) as a generator changes the graph rather than describing the hypercube.

Another potential confusion is ordinary integer addition. In \(B_n\), addition is coordinatewise modulo two, with no carrying between coordinates. For example, \(01+01=00\), not the binary representation of the ordinary integer \(2\). The coordinatewise rule is what makes every generator a single-coordinate flip.

Check Your Understanding

Use the Boolean group operation and the stated generator set in each question.

  1. In \(B_3\), compute \(101+010\). Which coordinates change?
  2. List the neighbors of \(011\) in \(Q_3\), and explain why there are no others.
  3. What is the distance in \(Q_5\) between \(11001\) and \(00111\)? Give a path of that length.
  4. Explain why \(Q_0\) has no edges even though its single vertex is connected to itself by a length-zero path.
  5. For \(n\ge1\), derive the edge count of \(Q_n\) from its order and degree.