Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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:

Rubik's cube, solved state transformed to one front-twist

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:

Rubik's cube, first twist

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?

share|improve this question

1 Answer 1

up vote 10 down vote accepted

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]

Mathematica graphics

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.

share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.