# Hypercube graph

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Hypercube_graph
> Markdown URL: https://mediated.wiki/source/Hypercube_graph.md
> Source: https://en.wikipedia.org/wiki/Hypercube_graph
> Source revision: 1345431030
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{Short description|Graphs formed by a hypercube's edges and vertices}}
{{infobox graph
 | name = Hypercube graph
 | image = 200px|class=skin-invert-image
 | image_caption = The hypercube graph <math>Q_4</math>
 | vertices = <math>2^n</math>
 | edges = <math>2^{n-1}n</math>
 | automorphisms =  <math>n!2^n</math>
 | chromatic_number = 2
 | chromatic_index = 
 | girth = 4 if <math>n\ge 2</math>
 | diameter = <math>n</math>
 | spectrum = <math>\{(n - 2 k)^{\binom{n}{k}}; k = 0, \ldots, n\}</math>
 | properties = [Symmetric](/source/Symmetric_graph)<br>[Distance regular](/source/Distance_regular_graph)<br>[Unit distance](/source/Unit_distance_graph)<br>[Hamiltonian](/source/Hamiltonian_graph)<br>[Bipartite](/source/Bipartite_graph)<br>[Polytopal](/source/Graph_of_a_polytope)
 | notation = <math>Q_n</math>
}}

In [graph theory](/source/graph_theory), the  '''hypercube graph''' <math>Q_n</math> is the [edge graph](/source/Graph_of_a_polytope) of the <math>n</math>-dimensional [hypercube](/source/hypercube), that is, it is the graph formed from the vertices and edges of the hypercube. For instance, the [cube graph](/source/cubical_graph) <math>Q_3</math> is the graph formed by the 8 vertices and 12 edges of a three-dimensional cube.
<math>Q_n</math> has <math>2^n</math> [vertices](/source/vertex_(graph_theory)), <math>2^{n-1}n</math> edges, and is a [regular graph](/source/regular_graph) with <math>n</math> edges touching each vertex.

The hypercube graph <math>Q_n</math> may also be constructed by creating a vertex for each [subset](/source/subset) of an <math>n</math>-element set, with two vertices adjacent when their subsets differ in a single element, or by creating a vertex for each <math>n</math>-digit [binary number](/source/binary_number), with two vertices adjacent when their binary representations differ in a single digit. It is the <math>n</math>-fold [Cartesian product](/source/Cartesian_product_of_graphs) of the two-vertex [complete graph](/source/complete_graph), and may be decomposed into two copies of <math>Q_{n-1}</math> connected to each other by a [perfect matching](/source/perfect_matching).

Hypercube graphs should not be confused with [cubic graph](/source/cubic_graph)s, which are graphs that have exactly three edges touching each vertex.  The only hypercube graph <math>Q_n</math> that is a cubic graph is the cubical graph <math>Q_3</math>.

== Construction ==
241px|class=skin-invert|thumb|left|Construction of {{math|''Q''<sub>3</sub>}} by connecting pairs of corresponding vertices in two copies of {{math|''Q''{{sub|2}}}}
The hypercube graph <math>Q_n</math> may be constructed from the family of [subsets](/source/subsets) of a [set](/source/Set_(mathematics)) with <math>n</math> elements, by making a vertex for each possible subset and joining two vertices by an edge whenever the corresponding subsets differ in a single element. Equivalently, it may be constructed using <math>2^n</math> vertices labeled with <math>n</math>-bit [binary number](/source/binary_number)s and connecting two vertices by an edge whenever the [Hamming distance](/source/Hamming_distance) of their labels is one. These two constructions are closely related: a binary number may be interpreted as a set (the set of positions where it has a nonzero digit), and two such sets differ in a single element whenever the corresponding two binary numbers have Hamming distance one.

Alternatively, <math>Q_n</math> may be constructed from the [disjoint union](/source/disjoint_union) of two hypercubes <math>Q_{n-1}</math>, by adding an edge from each vertex in one copy of <math>Q_{n-1}</math> to the corresponding vertex in the other copy, as shown in the figure. The joining edges form a [perfect matching](/source/perfect_matching).

The above construction gives a recursive algorithm for constructing the [adjacency matrix](/source/adjacency_matrix) of a hypercube, <math>A_n</math>. Copying is done via the [Kronecker product](/source/Kronecker_product) <math>\otimes_K</math>, so that the two copies of <math>Q_{n-1}</math> have an adjacency matrix <math>\mathrm{1}_2\otimes_K  A_{n-1}</math>,where <math>1_d</math> is the <math>d\times d</math> [identity matrix](/source/identity_matrix). Meanwhile the joining edges have an adjacency matrix <math>A_{1} \otimes_K 1_{2^{n-1} }</math>. The sum of these two terms gives a recursive function for the adjacency matrix of a hypercube:<math display=block>A_{n} = \begin{cases}
1_2\otimes_K A_{n-1}+A_1\otimes_K 1_{2^{n-1}} & \text{if } n>1\\
\begin{bmatrix}
0 & 1\\
1 & 0
\end{bmatrix}
&\text{if }n=1
\end{cases}</math>
Another construction of <math>Q_n</math> is the [Cartesian product](/source/Cartesian_product_of_graphs) of <math>n</math>  two-vertex complete graphs <math>K_2</math>. More generally the Cartesian product of copies of a complete graph is called a [Hamming graph](/source/Hamming_graph); the hypercube graphs are examples of Hamming graphs.

== Examples ==
The graph <math>Q_0</math> consists of a single vertex, while <math>Q_1</math> is the [complete graph](/source/complete_graph) on two vertices.

<math>Q_2</math> is a [cycle](/source/cycle_(graph_theory)) of {{nowrap|length 4.}}

The graph <math>Q_3</math> is the [1-skeleton](/source/n-skeleton) of a [cube](/source/cube) and is a planar graph with eight [vertices](/source/Vertex_(geometry)) and twelve [edges](/source/Edge_(geometry)).

The graph <math>Q_4</math> is the [Levi graph](/source/Levi_graph) of the [Möbius configuration](/source/M%C3%B6bius_configuration). It is also the [knight's graph](/source/knight's_graph) for a [toroidal](/source/torus) <math>4\times 4</math> [chessboard](/source/chessboard).<ref>{{citation|title=Across the Board: The Mathematics of Chessboard Problems|first=John J.|last=Watkins|publisher=Princeton University Press|year=2004|page=68|isbn=978-0-691-15498-5}}.</ref>

== Properties ==

===Bipartiteness===
Every hypercube graph is [bipartite](/source/bipartite_graph): it can be [colored](/source/graph_coloring) with only two colors. The two colors of this coloring may be found from the subset construction of hypercube graphs, by giving one color to the subsets that have an even number of elements and the other color to the subsets with an odd number of elements.

=== Hamiltonicity ===
thumb|upright=1.25|class=skin-invert|A Hamiltonian cycle on a tesseract with vertices labelled with a 4-bit cyclic Gray code
Every hypercube <math>Q_n</math> with <math>n>1</math> has a [Hamiltonian cycle](/source/Hamiltonian_path), a cycle that visits each vertex exactly once. Additionally, a [Hamiltonian path](/source/Hamiltonian_path) exists between two vertices <math>u</math> and <math>v</math> if and only if they have different colors in a 2-coloring of the graph. Both facts are easy to prove using the principle of [induction](/source/mathematical_induction) on the dimension of the hypercube, and the construction of the hypercube graph by joining two smaller hypercubes with a matching.

Hamiltonicity of the hypercube is tightly related to the theory of [Gray codes](/source/Gray_codes). More precisely there is a [bijective](/source/bijection) correspondence between the set of <math>n</math>-bit cyclic Gray codes and the set of Hamiltonian cycles in the {{nowrap|hypercube <math>Q_n</math>.<ref>{{citation
  | title = Some complete cycles on the {{mvar|n}}-cube
  | last = Mills | first = W. H.
  | journal = Proceedings of the American Mathematical Society
  | year = 1963
  | pages = 640–643
  | doi = 10.2307/2034292
  | volume = 14
  | issue = 4
  | publisher = American Mathematical Society
  | jstor = 2034292}}.</ref>}} An analogous property holds for acyclic <math>n</math>-bit Gray codes and Hamiltonian paths.

A lesser known fact is that every perfect matching in the hypercube extends to a Hamiltonian cycle.<ref>{{citation|first=J.|last=Fink|title=Perfect matchings extend to Hamiltonian cycles in hypercubes|journal=Journal of Combinatorial Theory, Series B|volume=97|year=2007|pages=1074–1076|doi=10.1016/j.jctb.2007.02.007|issue=6|doi-access=free}}.</ref> The question whether every matching extends to a Hamiltonian cycle remains an open problem.<ref>Ruskey, F. and [Savage, C.](/source/Carla_Savage) [http://garden.irmacs.sfu.ca/?q=op/matchings_extends_to_hamilton_cycles_in_hypercubes Matchings extend to Hamiltonian cycles in hypercubes] on Open Problem Garden. 2007.</ref>

=== Other properties ===
The hypercube graph <math>Q_n</math> (for <math>n>1</math>) :
* is the [Hasse diagram](/source/Hasse_diagram) of a finite [Boolean algebra](/source/Boolean_algebra_(structure)).
* is a [median graph](/source/median_graph). Every median graph is an [isometric subgraph of a hypercube](/source/partial_cube), and can be formed as a retraction of a hypercube.
* has more than <math>2^{2^{n-2}}</math> perfect matchings. (this is another consequence that follows easily from the inductive construction.)
* is [arc transitive](/source/Arc-transitive_graph) and [symmetric](/source/Symmetric_graph).  The symmetries of hypercube graphs can be represented as [signed permutations](/source/Wreath_product).
* contains all the cycles of length <math>4,6,\dots 2^n</math> and is thus a [bipancyclic graph](/source/Pancyclic_graph).
* can be [drawn](/source/Graph_drawing) as a [unit distance graph](/source/unit_distance_graph) in the Euclidean plane by using the construction of the hypercube graph from subsets of a set of <math>n</math> elements, choosing a distinct [unit vector](/source/unit_vector) for each set element, and placing the vertex corresponding to the set <math>S</math> at the sum of the vectors in <math>S</math>.
* is a [{{mvar|n}}-vertex-connected graph](/source/k-vertex-connected_graph), by [Balinski's theorem](/source/Balinski's_theorem).
* is [planar](/source/planar_graph) (can be [drawn](/source/graph_drawing) with no crossings) if and only if <math>n\le 3</math>. For larger values of <math>n</math>, the hypercube has {{nowrap|[genus](/source/Genus_(mathematics)) <math>(n-4)2^{n-3}+1</math>.<ref name="ringel">{{citation
| last1 = Ringel | first1 = G. | author1-link = Gerhard Ringel
| journal = Abh. Math. Sem. Univ. Hamburg| mr = 949280
| pages = 10–19
| title = Über drei kombinatorische Probleme am {{mvar|n}}-dimensionalen Wiirfel und Wiirfelgitter| volume = 20
| year = 1955}}</ref><ref name="hhw">{{citation
 | last1 = Harary | first1 = Frank | author1-link = Frank Harary
 | last2 = Hayes | first2 = John P.
 | last3 = Wu | first3 = Horng-Jyh
 | doi = 10.1016/0898-1221(88)90213-1
 | issue = 4
 | journal = Computers & Mathematics with Applications
 | mr = 949280
 | pages = 277–289
 | title = A survey of the theory of hypercube graphs
 | volume = 15
 | year = 1988| url = http://deepblue.lib.umich.edu/bitstream/handle/2027.42/27522/0000566.pdf?sequence=1
 | hdl = 2027.42/27522
 | hdl-access = free
 }}.</ref>}}
* has exactly <math>2^{2^n-n-1}\prod_{k=2}^n k^{{n\choose k}}</math> [spanning tree](/source/spanning_tree)s.<ref name="hhw"/>
* has [bandwidth](/source/graph_bandwidth) exactly <math>\sum_{i=0}^{n-1} \binom{i}{\lfloor i/2\rfloor}</math>.<ref>Optimal Numberings and Isoperimetric Problems on Graphs, L.H. Harper, [Journal of Combinatorial Theory](/source/Journal_of_Combinatorial_Theory), 1, 385&ndash;393, {{doi|10.1016/S0021-9800(66)80059-5}}</ref>
* has [achromatic number](/source/Complete_coloring) proportional to <math>\sqrt{n2^n}</math>, but the constant of proportionality is not known precisely.<ref>{{citation|last=Roichman|first=Y.|title= On the Achromatic Number of Hypercubes|journal=Journal of Combinatorial Theory, Series B|volume=79|issue=2|year=2000|pages=177–182|doi=10.1006/jctb.2000.1955|doi-access=free}}.</ref>
* has as the eigenvalues of its [adjacency matrix](/source/adjacency_matrix) the numbers <math>\{-n,-n+2,-n+4,\dots,n-4,n-2,n\}</math> and as the eigenvalues of its Laplacian matrix the numbers <math>\{0,2,\dots,2n\}</math>. The <math>k</math>th eigenvalue has multiplicity <math>\binom{n}{k}</math> in both cases.
* has [isoperimetric number](/source/Expander_graph) <math>h(G)=1</math>.

The family <math>Q_n</math> for all <math>n>1</math> is a [Lévy family of graphs](/source/L%C3%A9vy_family_of_graphs).

== Problems ==
{{snakes_and_coils_in_the_box.svg}}
The problem of finding the [longest path](/source/longest_path) or cycle that is an [induced subgraph](/source/induced_subgraph) of a given hypercube graph is known as the [snake-in-the-box](/source/snake-in-the-box) problem.

[Szymanski's conjecture](/source/Szymanski's_conjecture) concerns the suitability of a hypercube as a [network topology](/source/network_topology) for communications. It states that, no matter how one chooses a [permutation](/source/permutation) connecting each hypercube vertex to another vertex with which it should be connected, there is always a way to connect these pairs of vertices by [paths](/source/path_(graph_theory)) that do not share any directed edge.<ref>{{citation
 | last = Szymanski | first = Ted H.
 | contribution = On the Permutation Capability of a Circuit-Switched Hypercube
 | location = Silver Spring, MD
 | pages = 103–110
 | publisher = IEEE Computer Society Press
 | title = Proc. Internat. Conf. on Parallel Processing
 | volume = 1
 | year = 1989}}.</ref>

== See also ==
{{commons category|Hypercube graphs}}
* [de Bruijn graph](/source/de_Bruijn_graph)
* [Cube-connected cycles](/source/Cube-connected_cycles)
* [Fibonacci cube](/source/Fibonacci_cube)
* [Folded cube graph](/source/Folded_cube_graph)
* [Frankl–Rödl graph](/source/Frankl%E2%80%93R%C3%B6dl_graph)
* [Halved cube graph](/source/Halved_cube_graph)
* [Hypercube internetwork topology](/source/Hypercube_internetwork_topology)
* [Partial cube](/source/Partial_cube)

== Notes ==
{{Reflist}}

== References ==
* {{citation
  | title = A survey of the theory of hypercube graphs
  | authorlink1 = Frank Harary | last1 = Harary | first1 = F.
  | last2 = Hayes | first2 = J. P. | last3 = Wu | first3 = H.-J.
  | journal = Computers & Mathematics with Applications
  | volume = 15
  | issue = 4
  | pages = 277–289
  | year = 1988
  | doi = 10.1016/0898-1221(88)90213-1| hdl = 2027.42/27522
  | hdl-access = free
  }}.

Category:Parametric families of graphs
Category:Regular graphs

---
Adapted from the Wikipedia article [Hypercube graph](https://en.wikipedia.org/wiki/Hypercube_graph) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Hypercube_graph?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
