Learn R Programming

gor (version 2.0)

make_cube: Multidimensional cube graph

Description

Multidimensional cube graph: 4-cycle (\(\mu=2\)), ordinary cube (\(\mu=3\)), tesseract (\(\mu=4\)), etc.

Usage

make_cube(mu)

Value

The \(\mu\)-dimensional cube graph in igraph format.

Arguments

mu

Dimension of the cube, a nonnegative integer.

Author

Cesar Asensio

Details

This is a recursive function: It forms the \(\mu\)-cube by joining two (\(\mu-1\))-cubes vertex by vertex, starting from the 1-cube, which is \(K_1\), a single vertex with no edges. The \(\mu\)-cube has \(2^\mu\) vertices and \(\mu\times2^{\mu-1}\) edges, so it is exponentially big in \(\mu\), please consider this when creating a \(\mu\)-cube with moderate \(\mu\) (and don't create any cube with large \(\mu\)).

Examples

Run this code
library(igraph)
q3 <- make_cube(3)
cu <- make_graph("Cubical")
isomorphic(cu, q3)   # TRUE

Run the code above in your browser using DataLab