プリンキピア

第12章グラフ理論

12.8 Hamilton Paths12.8 ハミルトンパス

A group of children getting on a school bus.
Figure 12.165図12.165
A school bus picks up children along a planned route. (credit: “Kids at School Bus Stop” by Ty Hatch/Flickr, CC BY 2.0)
英語のヒント
スクールバスが計画された経路に沿って子どもたちを乗せる。(出典:Ty Hatch の “Kids at School Bus Stop”/Flickr、CC BY 2.0)

Learning Objectives学習目標

After completing this section, you should be able to:
英語のヒント
この節を終えると、次のことができるようになる。
  1. Describe and identify Hamilton paths.
    英語のヒント
    ハミルトンパスを述べて見きわめる。
  2. Evaluate Hamilton paths in real-world applications.
    英語のヒント
    現実世界の応用でハミルトンパスを評価する。
  3. Distinguish between Hamilton paths and Euler trails.
    英語のヒント
    ハミルトンパスとオイラー小道を区別する。
In the United States, school buses carry 25 million children between school and home every day. The total distance they travel is around 6 billion kilometers per year. In the city of Boston, Massachusetts, the 2016 budget for running those buses was $120 million dollars. In 2017, the city held a competition to find ways to cut costs and the Quantum Team from the MIT Operations Research Center came to the rescue, using a computer algorithm to identify the most efficient and least costly routes, which saved the city of Boston $5 million each year and even reduced daily CO2 emissions by 9,000 kilograms! (This U.S. city put an algorithm in charge of its school bus routes and saved $5 million, Sean Fleming, World Economic Forum)
英語のヒント
アメリカでは、スクールバスが毎日2500万人の子どもを学校と家のあいだで運ぶ。バスが走る距離の合計は年に約60億キロメートルである。マサチューセッツ州ボストン市では、2016年のこれらのバスの運行予算は1億2000万ドルだった。2017年、市は費用を削る方法を見つけるコンテストを開いた。MITオペレーションズ・リサーチ・センターのクォンタム・チームが救いに来て、コンピュータのアルゴリズムを使ってもっとも効率がよくもっとも費用の少ない経路を見きわめた。これでボストン市は毎年500万ドルを節約し、毎日のCO2排出量も9,000キログラム減った!(This U.S. city put an algorithm in charge of its school bus routes and saved $5 million, Sean Fleming, World Economic Forum)
The problem the Quantum Team tackled involves graph theory. Imagine a graph in which vertices are the bus depot, the school, and the bus stops along a particular route. The bus must start at the depot, visit every stop exactly once, and end at the school. The route is a special kind of path that visits every vertex exactly once. Can you guess what those paths are called?
英語のヒント
クォンタム・チームが取り組んだ問題はグラフ理論にかかわる。頂点が、バスの車庫、学校、ある経路の上のバス停であるグラフを想像しよう。バスは車庫を出発し、すべてのバス停をちょうど1回訪れ、学校で終わらなければならない。この経路は、すべての頂点をちょうど1回訪れる特別な種類のパスである。これらのパスが何と呼ばれるか推測できるだろうか。

Hamilton Pathsハミルトンパス

Just as circuits that visit each vertex in a graph exactly once are called Hamilton cycles (or Hamilton circuits), paths that visit each vertex on a graph exactly once are called Hamilton paths. As we explore Hamilton paths, you might find it helpful to refresh your memory about the relationships between walks, trails, and paths by looking at Figure 12.166. We know that paths are walks that don’t repeat any vertices or edges. So, a Hamilton path visits every vertex without repeating any vertices or edges. Figure 12.167 shows a path from vertex A to vertex E and a Hamilton path from vertex A to vertex E.
英語のヒント
グラフの各頂点をちょうど1回訪れる回路をハミルトン閉路(またはハミルトン回路)というのと同じように、グラフの各頂点をちょうど1回訪れるパスをハミルトンパスという。ハミルトンパスを調べるときは、図12.166を見て歩道、小道、パスの関係を思い出すと役に立つかもしれない。パスは頂点も辺も繰り返さない歩道であることを知っている。だから、ハミルトンパスは頂点も辺も繰り返さずにすべての頂点を訪れる。図12.167は、頂点Aから頂点Eへのパスと、頂点Aから頂点Eへのハミルトンパスを示している。
Three concentric ovals represent paths, trails, and walks. The first (inner) oval labeled paths reads, no repeated edges or vertices. The second oval labeled trails reads, no repeated edges. The third oval is labeled walks.
Figure 12.166図12.166
Walks, Trails, and Paths
英語のヒント
歩道、小道、パス
Two graphs. Each graph has five vertices: A, B, C, D, and E. In the first graph, directed edges flow from A to B, B to C, and C to E. In the second graph, directed edges flow from A to B, B to C, C to D, and D to E.
Figure 12.167図12.167
Path or Hamilton Path?
英語のヒント
パスか、ハミルトンパスか
Example 12.38例題 12.38

Identifying Hamilton Pathsハミルトンパスを見きわめる

Which of the following sequences of vertices is a Hamilton path for Graph Q in Figure 12.168?
英語のヒント
次の頂点の列のうち、図12.168のグラフQのハミルトンパスはどれか。
Graph Q has two overlapping quadrilaterals. The vertices of the outer quadrilateral are a, c, h, and f. The vertices of the inner quadrilateral are d, b, e, and g. The vertex, d rests on the edge a f. The vertex, b rests on the edge a c. The vertex, e rests on the edge c h. The vertex, g rests on the edge h f.
Figure 12.168図12.168
Graph Q
英語のヒント
グラフQ
  1. a → d → b → c → e → g → f
  2. c → b → e → h → g → f → d → a
  3. h → e → g → d → b → e → g → f → d → a → b → c
Solution解答
Sequence 1 is a path, because it is a walk that doesn’t repeat any vertices or edges, but not a Hamilton path because it skips vertex h. Sequence 2 is a path that visits each vertex exactly once; so, it is a Hamilton path. Sequence 3 is a walk, but it is not a path because it visits vertices g, e, and b each more than once; so, it cannot be a Hamilton path. So, we can see that only sequence 2 is a Hamilton path.
英語のヒント
列1は、頂点も辺も繰り返さない歩道なのでパスだが、頂点hを飛ばすのでハミルトンパスではない。列2は、各頂点をちょうど1回訪れるパスなので、ハミルトンパスである。列3は歩道だが、頂点g、e、bをそれぞれ2回以上訪れるのでパスではなく、だからハミルトンパスになれない。だから、列2だけがハミルトンパスであることがわかる。

Finding Hamilton Pathsハミルトンパスを見つける

Suppose you were visiting an aquarium with some friends. The map of the aquarium is given in Figure 12.169. The letters represent the exhibits.
英語のヒント
あなたが友達と水族館を訪れているとする。水族館の地図を図12.169に示す。文字は展示を表す。
A map of aquarium exhibits. The vertices are labeled A to S. The entrance is at the bottom.
Figure 12.169図12.169
Map of Aquarium Exhibits
英語のヒント
水族館の展示の地図
Figure 12.170 shows a graph of the aquarium in which each vertex represents an exhibit and each edge is a route between the pair of exhibits that doesn’t bypass another exhibit.
英語のヒント
図12.170は水族館のグラフを示している。各頂点が展示を表し、各辺がほかの展示を通らずに行ける展示の組のあいだの経路である。
A graph has 19 vertices labeled from A to S. Edges connect A C, C B, B S, B E, S E, E D, A D, D F, A F, D G, G E, F I, F J, I J, I P, J P, J K, P O, G H, H L, L N, N K, K H, H N, L K, L M, N M, O Q, M Q, Q R, M R, and S R.
Figure 12.170図12.170
Graph of Aquarium
英語のヒント
水族館のグラフ
Let’s see if we can plan a tour of the exhibits that visits each exhibit exactly once, beginning at exhibit O and ending at exhibit C. Suppose that, after exhibit O, we plan to visit exhibit Q and then exhibit M. After M, should we plan to visit N, L, or R? Take a look at Figure 12.171. If R is not chosen next, that will cause a problem later on. Do you see what it is?
英語のヒント
展示Oで始まり展示Cで終わる、各展示をちょうど1回訪れる見学を計画できるか見てみよう。展示Oのあと、展示Q、次に展示Mを訪れる計画だとする。Mのあとは、N、L、Rのどれを訪れる計画にすべきか。図12.171を見よう。Rを次に選ばないと、あとで問題が起こる。それが何かわかるだろうか。
A graph has 19 vertices labeled from A to S. Edges connect A C, C B, B S, B E, S E, E D, A D, D F, A F, D G, G E, F I, F J, I J, I P, J P, J K, P O, G H, H L, L N, N K, K H, H N, L K, L M, N M, O Q, M Q, Q R, M R, and S R. The edges, O Q, Q M, M R, M L, and M N are directed. A question mark is above M.
Figure 12.171図12.171
Choosing Vertex L, N, or R
英語のヒント
頂点L、N、Rを選ぶ
If L or N is chosen next, the only way to get to R later will be to go from S to R, and then we will not be able to continue without repeating a vertex. So, we will pick R next, and then the only option is S. After S we have another choice to make. As shown in Figure 12.172, the next choice is between B and E. Keeping in mind that the goal is to end at C, which would be the better choice?
英語のヒント
LかNを次に選ぶと、あとでRへ行く唯一の方法はSからRへ行くことになり、そのあと頂点を繰り返さずに進めなくなる。だから、次にRを選び、そのあとの選択肢はSだけである。Sのあとにまた選択がある。図12.172に示すように、次の選択はBとEのどちらかである。目標がCで終わることだと頭に置くと、どちらが良い選択だろうか。
A graph has 19 vertices labeled from A to S. Edges connect A C, C B, B S, B E, S E, E D, A D, D F, A F, D G, G E, F I, F J, I J, I P, J P, J K, P O, G H, H L, L N, N K, K H, H N, L K, L M, N M, O Q, M Q, Q R, M R, and S R. The edges, O Q, Q M, M R, R S, S B, and S E are directed. A question mark is above S.
Figure 12.172図12.172
Choosing Vertex B or E
英語のヒント
頂点BかEを選ぶ
If you said vertex B, you are right! Otherwise, we will not be able to visit B later. After B, the only option is E. Then we can choose either D or G. Either will work fine. Let’s choose G as shown in Figure 12.173. After G, you must visit H, but should you visit K or L after that?
英語のヒント
頂点Bと答えたなら、正解である!そうしないと、あとでBを訪れられなくなる。Bのあとの選択肢はEだけである。それからDかGを選べる。どちらでもうまくいく。図12.173に示すようにGを選ぼう。Gのあとは、Hを訪れなければならないが、そのあとはKとLのどちらを訪れるべきか。
A graph has 19 vertices labeled from A to S. Edges connect A C, C B, B S, B E, S E, E D, A D, D F, A F, D G, G E, F I, F J, I J, I P, J P, J K, P O, G H, H L, L N, N K, K H, H N, L K, L M, N M, O Q, M Q, Q R, M R, and S R. The edges, O Q, Q M, M R, R S, S B, B E, E G, G H, H L, and H K are directed. A question mark is above H.
Figure 12.173図12.173
Choose Vertex L or K
英語のヒント
頂点LかKを選ぶ
If you said to go to vertex L next, you are right! Otherwise, it will be impossible to visit N without repeating a vertex. So, next is L, then N, then K, and then at J you have another decision to make we can see in Figure 12.174. Should you choose F, I, or P next?
英語のヒント
次に頂点Lへ行くと答えたなら、正解である!そうしないと、頂点を繰り返さずにNを訪れることは不可能になる。だから、次はL、それからN、それからKで、そしてJで、図12.174でわかるようにまた決めることがある。次にF、I、Pのどれを選ぶべきか。
A graph has 19 vertices labeled from A to S. Edges connect A C, C B, B S, B E, S E, E D, A D, D F, A F, D G, G E, F I, F J, I J, I P, J P, J K, P O, G H, H L, L N, N K, K H, H N L K, L M, N M, O Q, M Q, Q R, M R, and S R. The edges, O Q, Q M, M R, R S, S B, B E, E G, G H, H L, L N, N K, K J, J F, J I, and J P are directed. A question mark is above J.
Figure 12.174図12.174
Choose Vertex F, I, or P
英語のヒント
頂点F、I、Pを選ぶ
If you said P, you are right! If you choose either of the other two vertices, you will not be able to visit P later without passing through another vertex twice. Once P is chosen, vertex I must be next followed by F. Then you have to choose between A and D as shown in Figure 12.175.
英語のヒント
Pと答えたなら、正解である!ほかの2つの頂点のどちらかを選ぶと、別の頂点を2回通らずにあとでPを訪れることができなくなる。Pを選ぶと、次は頂点I、続いてFでなければならない。それから、図12.175に示すようにAとDのどちらかを選ばなければならない。
A graph has 19 vertices labeled from A to S. Edges connect A C, C B, B S, B E, S E, E D, A D, D F, A F, D G, G E, F I, F J, I J, I P, J P, J K, P O, G H, H L, L N, N K, K H, H N, L K, L M, N M, O Q, M Q, Q R, M R, and SR. The edges, O Q, Q M, M R, R S, S B, B E, E G, G H, H L, L N, N K, K J, J P, P I, I F, F A, and F D are directed. A question mark is above F.
Figure 12.175図12.175
Choose Vertex A or D
英語のヒント
頂点AかDを選ぶ
In this case, we must go to D then to A so that we can visit C without backtracking. The complete Hamilton path is shown in Figure 12.176.
英語のヒント
この場合、引き返さずにCを訪れられるように、Dへ行ってからAへ行かなければならない。完全なハミルトンパスを図12.176に示す。
A graph has 19 vertices labeled from A to S. Edges connect A C, C B, B S, B E, S E, E D, A D, D F, A F, D G, G E, F I, F J, I J, I P, J P, J K, P O, G H, H L, L N, N K, K H, H N, L K, L M, N M, O Q, M Q, Q R, M R, and S R. The edges, O Q, Q M, M R, R S, S B, B E, E G, G H, H L, L N, N K, K J, J P, P I, I F, F D, D A, and A C are directed.
Figure 12.176図12.176
Complete Hamilton Path from O to C
英語のヒント
OからCへの完全なハミルトンパス
So, one Hamilton path that begins at O and ends at C is O → Q → M → R → S → B → E → G → H → L → N → K → J → P → I → F → D → A → C.
英語のヒント
だから、Oで始まりCで終わるハミルトンパスの1つはO → Q → M → R → S → B → E → G → H → L → N → K → J → P → I → F → D → A → Cである。
There is no set sequence of steps that can be used to find a Hamilton path if it exists, but it does help to keep in mind where we are headed and avoid choices that will make returning to a particular vertex impossible without repeating vertices. Let’s practice finding Hamilton paths.
英語のヒント
ハミルトンパスがあるときにそれを見つけるのに使える決まった手順の列はないが、どこへ向かっているかを頭に置き、頂点を繰り返さずに特定の頂点へ戻ることを不可能にする選択を避けると役に立つ。ハミルトンパスを見つける練習をしよう。
Example 12.39例題 12.39
Finding a Hamilton Pathハミルトンパスを見つける
Use Figure 12.177 to find a Hamilton path between vertices C and D.
英語のヒント
図12.177を使って、頂点CとDのあいだのハミルトンパスを見つけよ。
Graph G has six vertices. The vertices are C, A, B, F, D, and E. Edges connect C A, A B, A F, B F, F D, F E, and D E.
Figure 12.177図12.177
Graph G
英語のヒント
グラフG
Solution解答
If we start at vertex C, A must be next. Then we must choose between B and F. If we choose F, we will have to backtrack to get to include B; so, we must choose B. Once we choose B, we must choose F next. After F, we choose E, because we want to end at D. So, a Hamilton path between C and D is C → A → B → F → E → D.
英語のヒント
頂点Cから始めるなら、次はAでなければならない。それからBとFのどちらかを選ばなければならない。Fを選ぶと、Bを含めるのに引き返さなければならなくなるので、Bを選ばなければならない。Bを選ぶと、次はFを選ばなければならない。Fのあとは、Dで終わりたいのでEを選ぶ。だから、CとDのあいだのハミルトンパスはC → A → B → F → E → Dである。