New in Wolfram
Mathematica
8: Graph & Network Analysis
◄
previous
|
next
►
Application Areas
Solve the Icosian Game
Find a Hamiltonian cycle along the edges of the dodecahedron.
In[1]:=
X
data[property_] := PolyhedronData["Dodecahedron", property];
In[2]:=
X
faceStyle = Directive[ColorData["Rainbow"][0.25], Opacity[.7], EdgeForm[LightGray]];
In[3]:=
X
Row[{Graphics3D[{faceStyle, data["Faces"]}], Spacer[35], g = data["SkeletonGraph"]}]
In[4]:=
X
h = PathGraph[First[FindHamiltonianCycle[g]]];
In[5]:=
X
tubeStyle = Directive[Red, Opacity[1]];
In[6]:=
X
Row[{HighlightGraph[g, h, GraphHighlightStyle -> "Thick"], Spacer[35], Graphics3D[{faceStyle, data["Faces"], tubeStyle, Tube[data["VertexCoordinates"][[ Append[#, #[[1]]] &@VertexList[h]]], 0.1]}]}]
Out[3]=
Out[6]=