プリンキピア

第12章グラフ理論

12.4 Navigating Graphs12.4 グラフをたどる

People walking through a maze of hedges.
Figure 12.68図12.68
Visitors navigate a garden maze. (credit: “Longleat Maze” by Niki Odolphie/Wikimedia, CC BY 2.0)
英語のヒント
訪問者が庭園の迷路を進む。(出典:Niki Odolphie の “Longleat Maze”/Wikimedia、CC BY 2.0)

Learning Objectives学習目標

After completing this section, you should be able to:
英語のヒント
この節を終えると、次のことができるようになる。
  1. Describe and identify walks, trails, paths, and circuits.
    英語のヒント
    歩道、小道、パス、回路を述べて見きわめる。
  2. Solve application problems using walks, trails, paths, and circuits.
    英語のヒント
    歩道、小道、パス、回路を使って応用問題を解く。
  3. Identify the chromatic number of a graph.
    英語のヒント
    グラフの彩色数を見きわめる。
  4. Describe the Four-Color Problem.
    英語のヒント
    四色問題を述べる。
  5. Solve applications using graph colorings.
    英語のヒント
    グラフの彩色を使って応用問題を解く。
Now that we know the basic parts of graphs and we can distinguish one graph from another, it is time to really put our graphs to work for us. Many applications of graph theory involve navigating through a graph very much like you would navigate through a maze. Imagine that you are at the entrance to a maze. Your goal is to get from one point to another as efficiently as possible. Maybe there are treasures hidden along the way that make straying from the shortest path worthwhile, or maybe you just need to get to the end fast. Either way, you definitely want to avoid any wrong turns that would cause unnecessary backtracking. Luckily, graph theory is here to help!
英語のヒント
グラフの基本の部分を知り、グラフを互いに区別できるようになったので、いよいよグラフを実際に役立てるときである。グラフ理論の多くの応用では、迷路を進むのとよく似た形でグラフをたどる。迷路の入口にいると想像しよう。目標は、ある点から別の点へできるだけ効率よく行くことである。途中に宝が隠されていて最短の道からそれる価値があるかもしれないし、ただ速く終わりに着く必要があるだけかもしれない。いずれにせよ、不要な後戻りを生む間違った曲がり角はぜひ避けたい。幸い、グラフ理論が助けてくれる!

Walks歩道

Suppose Figure 12.69 is a maze you want to solve. You want to get from the start to the end.
英語のヒント
図12.69が解きたい迷路だとする。スタートからゴールへ行きたい。
A maze with its start and end labeled.
Figure 12.69図12.69
Your Maze
英語のヒント
あなたの迷路
You can approach this task any way you want. The only rule is that you can’t climb over the wall. To put this in the context of graph theory, let’s imagine that at every intersection and every turn, there is a vertex. The edges that join the vertices must stay within the walls. The graph within the maze would look like Figure 12.70.
英語のヒント
この課題にはどう取り組んでもよい。ただ1つの規則は、壁を乗り越えてはいけないことである。これをグラフ理論の文脈に置くと、すべての交差点と曲がり角に頂点があると想像しよう。頂点を結ぶ辺は壁の内側にとどまらなければならない。迷路のなかのグラフは図12.70のようになる。
A maze with its start and end labeled. Vertices are marked at each corner of the maze. A path connects all the vertices of the maze.
Figure 12.70図12.70
The Graph in Your Maze
英語のヒント
あなたの迷路のなかのグラフ
One approach to solving a maze is to just start walking. It is not the most efficient approach. You might cross through the same intersection twice. You might backtrack a bit. It’s okay. We are just out for a walk. It might look something like the black sequence of vertices and edges in Figure 12.71.
英語のヒント
迷路を解く1つの方法は、ただ歩き始めることである。もっとも効率のよい方法ではない。同じ交差点を2回通るかもしれない。少し後戻りするかもしれない。それでよい。ただ散歩に出ているだけである。図12.71の黒い頂点と辺の列のようになるかもしれない。
A maze with its start and end labeled. Vertices are marked at each corner of the maze. A path connects all the vertices of the maze. The path from start to end is highlighted.
Figure 12.71図12.71
The Walk Through the Graph in Your Maze
英語のヒント
あなたの迷路のグラフを通る歩道
This type of sequence of adjacent vertices and edges is actually called a walk (or directed walk) in graph theory too!
英語のヒント
この種の隣接する頂点と辺の列は、実際にグラフ理論でも歩道(または有向歩道)と呼ばれる!
A walk can be identified by naming the sequence of its vertices (or by naming the sequence of its edges if those are labeled). Let’s take the graph out of the context of the maze and give each vertex a name and each edge of the walk a direction as in Figure 12.72.
英語のヒント
歩道は頂点の列を挙げて(辺にラベルがあれば辺の列を挙げて)見きわめられる。迷路の文脈からグラフを取り出し、図12.72のように各頂点に名前を、歩道の各辺に方向を与えよう。
A graph with 19 vertices and 19 edges. The vertices are a, l, e, h, m, p, r, q, s, o, n, i, j, k, g, c, d, f, and b. The edges connect l a, a b, b f, e f, e h, h m, r s, p q, c d c j, g k, i j, j k, i n, n o, o q, and k s. The following path is highlighted p, q, o, n, i, j, k, s, and r. p is labeled start and q is labeled end. The edges from j to c and c to d are connected via double-headed arrows.
Figure 12.72図12.72
The Graph without Your Maze
英語のヒント
あなたの迷路のないグラフ
The name of this walk from p to r is p → q → o → n → i → j → c → d → c → j → k → s → r. When a particular edge on our graph was traveled in both directions, it had arrows in both directions and the letters of vertices that were visited more than once had to be repeated in the name of the walk.
英語のヒント
pからrへのこの歩道の名前はp → q → o → n → i → j → c → d → c → j → k → s → rである。グラフのある辺を両方向に通ったときは両方向の矢印があり、2回以上訪れた頂点の文字は歩道の名前で繰り返さなければならなかった。
Two graphs are labeled graph X and graph Y. Graph X has six vertices: a, b, c, d, e, and f. The vertices a, b, and e are connected by three edges and it resembles a triangle. The vertices, c, d, and f are connected by three edges and it resembles a triangle. These two triangles overlap and the point where they overlap has no vertex. The edges from b to d and d to f are highlighted. Graph Y is the same as that of graph X. The point where they overlap has a vertex, g.
Figure 12.73図12.73
A Walk or Not a Walk?
英語のヒント
歩道か、歩道でないか
The highlighted edges Graph Y in Figure 12.73 represent a walk between f and b. The highlighted edges in Graph X do not represent a walk between f and b, because there is a turn at a point that is not a vertex. This is like climbing over a wall when you are walking through a maze. Another way of saying this is that b → d → f is not a walk, because there is no edge between b and d.
英語のヒント
図12.73のグラフYの強調した辺は、fとbのあいだの歩道を表す。グラフXの強調した辺は、頂点でない点で曲がっているので、fとbのあいだの歩道を表さない。これは迷路を歩いているときに壁を乗り越えるようなものである。言いかえると、bとdのあいだに辺がないので、b → d → fは歩道ではない。
Example 12.19例題 12.19

Naming a Walk Through A House家のなかの歩道を名づける

Figure 12.74 shows the floor plan of a house. Use the floor plan to answer each question.
英語のヒント
図12.74は家の間取り図を示している。間取り図を使って各問いに答えよ。
A floor plan of a house includes the master bedroom, bedroom, kitchen, living room, hallway, garage, and restroom.
Figure 12.74図12.74
Floor Plan of a House
英語のヒント
家の間取り図
  1. Draw a graph to represent the floor plan in which each vertex represents a different room (or hallway) and edges represent doorways between rooms.
    英語のヒント
    各頂点が異なる部屋(または廊下)を表し、辺が部屋のあいだの出入り口を表す、間取り図のグラフを描け。
  2. Name a walk through the house that begins in the living room, ends in the garage and visits each room (or hallway) at least once.
    英語のヒント
    居間で始まり、ガレージで終わり、各部屋(または廊下)を少なくとも1回訪れる、家のなかの歩道を挙げよ。
Solution解答
  1. Step 1: We will need a vertex for each room and it is convenient to label them according to the names of the rooms. Visualize the scenario in your head as shown in Figure 12.75. You don’t have to write this step on your paper.
    英語のヒント
    手順1:各部屋の頂点が必要で、部屋の名前に従ってラベルをつけると便利である。図12.75に示すように、筋書きを頭に思い描く。この手順を紙に書く必要はない。
    A floor plan of a house includes the master bedroom, bedroom, kitchen, living room, hallway, garage, and restroom. The following vertices are assigned to rooms: master bedroom, M; bedroom, B; kitchen, K; living room, L; hallway, H; garage, G; and restroom, R. Edges from H lead to M, B, L, and G. Edges from L lead to K and R.
    Figure 12.75図12.75
    Assigning Vertices to Rooms
    英語のヒント
    頂点を部屋に割り当てる
    Step 2: Draw a graph to represent the scenario. Start with the vertices. Then connect those vertices that share a doorway in the floorplan as shown in Figure 12.76.
    英語のヒント
    手順2:筋書きを表すグラフを描く。頂点から始める。次に、図12.76に示すように、間取り図で出入り口を共有する頂点をつなぐ。
    A graph of the floor plan. The graph has seven vertices: M, B, K, H, L, G, and R. Edges from H lead to M, B, and G. Edges from L lead to K and R. An edge connects H with L.
    Figure 12.76図12.76
    Graph of the Floor plan
    英語のヒント
    間取り図のグラフ
  2. Step 1: Draw a path that begins at vertex L, representing the living room, and ending at vertex G, representing the garage making sure to visit every room at least once. There are many ways this can be done. You may want to number the edges to keep track of their order. One example is shown in Figure 12.77.
    英語のヒント
    手順1:すべての部屋を少なくとも1回訪れるようにして、居間を表す頂点Lで始まり、ガレージを表す頂点Gで終わるパスを描く。これには多くのやり方がある。順序を把握するために辺に番号を振るとよいかもしれない。1つの例を図12.77に示す。
    A graph of the floor plan. The graph has seven vertices: M, B, K, H, L, G, and R. Edge 1: L to R. Edge 2: R to L. Edge 3: L to K. Edge 4: K to L. Edge 5: L to H. Edge 6: H to B. Edge 7: B to H. Edge 8: H to M. Edge 9: M to H. Edge 10: H to G.
    Figure 12.77図12.77
    Draw the Path from L to G
    英語のヒント
    LからGへのパスを描く
    Step 2: Name the path that you followed by listing the vertices in the order you visited them.
    英語のヒント
    手順2:訪れた順に頂点を挙げて、たどったパスに名前をつける。
    L → R → L → K → L → H → B → H → M → H → G