Wolfram
Mathematica
8의 신기능: 그래프 및 네트워크 분석
◄
이전
|
다음
►
응용 분야
Icosian 게임 풀이
12 면체의 모서리를 따르는 해밀턴 순환을 찾아 봅니다.
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]=