Trip Planning
Plan a trip on the London Underground.
g = \!\(\*GraphicsBox[«6»]\);station = FindShortestPath[g, "Arsenal", "Alperton"]Clear[stop];lines = SplitBy[DeleteDuplicates[Flatten[Outer[stop, List @@ #, AnnotationValue[{g, #}, "Lines"]] & /@ EdgeList[PathGraph[station]]]], First];
stop[s_, l_] := StringJoin[{"take ", l, " at ", s}];linegraph = Graph[Flatten[{Outer[UndirectedEdge, {"Arsenal"}, lines[[1]]], UndirectedEdge@@@Subsets[#, {2}]& /@ lines, Outer[UndirectedEdge, #1, #2]&@@@Partition[lines, 2, 1], Outer[UndirectedEdge, lines[[-1]], {"Alperton"}]}]]FindShortestPath[linegraph, "Arsenal", "Alperton"]//Column