Wolfram
Mathematica
8의 신기능: 그래프 및 네트워크 분석
◄
이전
|
다음
►
응용 분야
순환 분해 채색
소수 개의 모서리를 가지는 그래프의 순환 분해를 채색해 봅니다.
In[1]:=
X
ColoringCycles[n_] := Block[{i, e}, e = Table[ Mod[#, n, 1] \[UndirectedEdge] Mod[# + i, n, 1] & /@ Range[n], {i, (n - 1)/2}]; HighlightGraph[ CompleteGraph[n, PlotLabel -> Style[n, 11, FontFamily -> "Verdana"]], Table[Style[e[[i]], ColorData[1][i]], {i, Length[e]}], ImageSize -> {150, 150}]];
In[2]:=
X
graphs = ColoringCycles[#] & /@ {3, 5, 7, 9, 11, 13};
In[3]:=
X
Grid[Partition[graphs, 3], Frame -> All, FrameStyle -> LightGray]
Out[3]=