# Visualizing Rubik's Graph

After the August 2010 discovery that the diameter of the Rubik graph is 20, I wanted to make a way to visualize Rubik's graph. Since there are about $4.3 \times 10^{19}$ vertices in this graph, it is not feasible to store the whole thing. However, it is a Cayley graph of a group with 6 generators, it is 6-regular, and given any vertex $v$ in the graph, it's neighborhood $N(v)$ can be generated.

Using Roman Maeder's Wolfram Demonstrations Project as a basis, I tried to make a way to visualize this graph, one neighborhood at a time.

Starting with the GraphicsComplex solved, and the operation twist, which is simple enough to operate:

I want to construct a graph that displays the neighborhood, namely, those configurations of the Rubik's cube that can be reached by a R,L,F,B,U or D operation. The edge corresponding to the operation above should look like this:

I would like to do three things:

• Given a configuration $v$, I would like to display $N(v)$, with the edges looking like the graphic above
• Make it interactive, so that when I click on one of the configurations, it's neighborhood is output
• Display the cubes as 3D objects, so that they can be rotated

The 3D part would be nice, but it's not necessary. How would I go about doing this?

-

I am not sure this is what you need. Please see if it helps. The little cubes are clickable, but not rotatable. We could put nicely formatted edge labels as well, but I didn't want to do that now as it would slow it down even more.

conf = solved;

Dynamic@Graph[
Join[
(conf -> twist[#, conf] &) /@ basic,
(twist[#, conf] -> conf &) /@ inv /@ basic
],

VertexShapeFunction -> (Inset[
Button[Graphics3D[#2, Boxed -> False], conf = #2,
Appearance -> None], #1, {0.5, 0.5}, #3] &), VertexSize -> 1,
EdgeStyle -> Black]


For others than the OP reading this:

You need to download the source of the demonstration, copy everything from the Initialization :> ( ... ) section of the Manipulate, and evaluate it. The code is very well written and very easy to work with.

-
Thanks for adding the bit about the source, I should have added that to the question. Your solution is just what I was looking for! –  Tobi Lehman Jan 21 '12 at 21:01