Wolfram
Mathematica
8의 신기능: 그래프 및 네트워크 분석
◄
이전
|
다음
►
응용 분야
여행 계획
런던 지하철로 여행하는 계획을 세워 봅니다.
In[1]:=
X
h = subwayLineChangeGraph[g, FindShortestPath[g, "Arsenal", "Alperton"]]
In[2]:=
X
presentTrip[p_List] := Join[{"Take " <> p[[2, 2]] <> " from " <> p[[2, 1]] <> "."}, Table["Change from " <> uv[[1, 2]] <> " to " <> uv[[2, 2]] <> " at " <> uv[[1, 1]] <> ".", {uv, Select[{p[[2 ;; -3]], p[[3 ;; -2]]}\[Transpose], #[[1, 1]] == #[[2, 1]] &]}], {"Get off " <> p[[-2, 2]] <> " at " <> p[[-2, 1]] <> "."}] // TableForm // Style[#, FontFamily -> "Verdana"] & presentTrip[FindShortestPath[h, "Arsenal", "Alperton"]]
Out[306]=
Out[2]//TableForm=