networkx.generators.lattice.hypercube_graph

hypercube_graph(n)[source]

Returns the n-dimensional hypercube graph.

The nodes are the integers between 0 and 2 ** n - 1, inclusive.

For more information on the hypercube graph, see the Wikipedia article Hypercube graph.

Parameters
nint

The dimension of the hypercube. The number of nodes in the graph will be 2 ** n.

Returns
NetworkX graph

The hypercube graph of dimension n.