12.6: Euler Trails Last updated Save as PDF Page ID129674 OpenStaxOpenStax \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \) \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\) \( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\) \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\) \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vectorC}[1]{\textbf{#1}} \) \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \) \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \) \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \) \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \) \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\) Figure 12.149 The Pony Express mail route spanned from California to Missouri. (credit: “Map of Pony Express” by Nathan Hughes Hamiltonh/Flickr, CC BY 2.0) Learning Objectives Describe and identify Euler trails. Solve applications using Euler trails theorem. Identify bridges in a graph. Apply Fleury’s algorithm. Evaluate Euler trails in real-world applications. We used Euler circuits to help us solve problems in which we needed a route that started and ended at the same place. In many applications, it is not necessary for the route to end where it began. In other words, we may not be looking at circuits, but trails, like the old Pony Express trail that led from Sacramento, California in the west to St. Joseph, Missouri in the east, never backtracking. Euler Trails If we need a trail that visits every edge in a graph, this would be called an Euler trail. Since trails are walks that do not repeat edges, an Euler trail visits every edge exactly once. Example 12.29: Recognizing Euler Trails Use Figure 12.150 to determine if each series of vertices represents a trail, an Euler trail, both, or neither. Explain your reasoning. Figure 12.150 Graph H a → b → e → g → f → c → d → e a → b → e → g → f → c → d → e → b → a → d → g g → d → a → b → e → d → c → f → g → e Answer It is a trail only. It is a trail because it is a walk that doesn’t cover any edges twice, but it is not an Euler trail because it didn’t cover edges ad or dg. It is neither. It is not a trail because it visits ab and be twice. Since it is not a trail, it cannot be an Euler trail. It is both. It is a trail because it is a walk that doesn’t cover any edges twice, and it is an Euler trail because it visits all the edges. Your Turn 12.29 Use the figure to determine if each sequence of vertices represents an Euler trail or not. If not, explain why. Figure 12.151: Graph I e → f → b → a → d → c → g → h → e → d d → a → b → f → e → h → g → c d → a → b → e → f → b → e → d → c → g → h → e The Five Rooms Puzzle Just as Euler determined that only graphs with vertices of even degree have Euler circuits, he also realized that the only vertices of odd degree in a graph with an Euler trail are the starting and ending vertices. For example, in Figure 12.150, Graph H has exactly two vertices of odd degree, vertex g and vertex e. Notice the Euler trail we saw in Excercise 3 of Example 12.29 began at vertex g and ended at vertex e. This is consistent with what we learned about vertices off odd degree when we were studying Euler circuits. We saw that a vertex of odd degree couldn't exist in an Euler circuit as depicted in Figure 12.152. If it was a starting vertex, at some point we would leave the vertex and not be able to return without repeating an edge. If it was not a starting vertex, at some point we would return and not be able to leave without repeating an edge. Since the starting and ending vertices in an Euler trail are not the same, the start is a vertex we want to leave without returning, and the end is a vertex we want to return to and never leave. Those two vertices must have odd degree, but the others cannot. Figure 12.152: A Vertex of Degree 3 Let’s use the Euler trail theorem to solve a puzzle so you can amaze your friends! This puzzle is called the “Five Rooms Puzzle.” Suppose that you were in a house with five rooms and the exterior. There is a doorway in every shared wall between any two rooms and between any room and the exterior as shown in Figure 12.153. Could you find a route through the house that passes through each doorway exactly once? Figure 12.153: Five Rooms Puzzle Let’s represent the puzzle with a graph in which vertices are rooms (or the exterior) and an edge indicates a door between two rooms as shown in Figure 12.154. Figure 12.154: Graph of Five Rooms Puzzle To pass through each doorway exactly once means that we cross every edge in the graph exactly once. Since we have not been asked to start and end at the same position, but to visit each edge exactly once, we are looking for an Euler trail. Let’s check the degrees of the vertices. Figure 12.155: Degrees of Vertices in Five Rooms Puzzle Since there are more than two vertices of odd degree as shown in Figure 12.155, the graph of the five rooms puzzle contains no Euler path. Now you can amaze and astonish your friends! Bridges and Local Bridges Now that we know which graphs have Euler trails, let’s work on a method to find them. The method we will use involves identifying bridges in our graphs. A bridge is an edge which, if removed, increases the number of components in a graph. Bridges are often referred to as cut-edges. In Figure 12.156, there are several examples of bridges. Notice that an edge that is not part of a cycle is always a bridge, and an edge that is part of a cycle is never a bridge. Figure 12.156: Graph with Bridges Edges bf, cg, and dg are “bridges” The graph in Figure 12.156 is connected, which means it has exactly one component. Each time we remove one of the bridges from the graph the number of components increases by one as shown in Figure 12.157. If we remove all three, the resulting graph in Figure 12.157 has four components. Figure 12.157 Removing a Bridge Increases Number of Components In sociology, bridges are a key part of social network analysis. Sociologists study two kinds of bridges: local bridges and regular bridges. Regular bridges are defined the same in sociology as in graph theory, but they are unusual when studying a large social network because it is very unlikely a group of individuals in a large social network has only one link to the rest of the network. On the other hand, a local bridge occurs much more frequently. A local bridge is a friendship between two individuals who have no other friends in common. If they lose touch, there is no single individual who can pass information between them. In graph theory, a local bridge is an edge between two vertices, which, when removed, increases the length of the shortest path between its vertices to more than two edges. In Figure 12.158, a local bridge between vertices b and e has been removed. As a result, the shortest path between b and e is b → i → j → k → e, which is four edges. On the other hand, if edge ab were removed, then there are still paths between a and b that cover only two edges, like a → i → b. Figure 12.158: Removing a Local Bridge The significance of a local bridge in sociology is that it is the shortest communication route between two groups of people. If the local bridge is removed, the flow of information from one group to another becomes more difficult. Let’s say that vertex b is Brielle and vertex e is Ella. Now, Brielle is less likely to hear about things like job opportunities, that Ella many know about. This is likely to impact Brielle as well as the friends of Brielle. Example 12.30: Identifying Bridges and Local Bridges Use the graph of a social network in Figure 12.159 to answer each question. Figure 12.159 Graph of a Social Network Identify any bridges. If all bridges were removed, how many components would there be in the resulting graph? Identify one local bridge. For the local bridge you identified in part 3, identify the shortest path between the vertices of the local bridge if the local bridge were removed. Answer The edges ku, gh, and hi are bridges. If the bridges were all removed, there would be four components in the resulting graph, {i}, {h}, {u, v, w, x}, and {a, b, c, d, e, f, g, j, k, m, n, o, p, q, r, s, t} as shown in Figure 12.160. Figure 12.160 Graph of Social Network without Bridges Three local bridges are dn, ef, and qt, among others. If dn were removed, the shortest path between d and n would be d → e → f → j → o → m → n. Your Turn 12.30 How many bridges and local bridges are in a complete graph with three or more vertices? Explain your reasoning. Video Bridges and Local Bridges in Graph Theory Finding an Euler Trail with Fleury’s Algorithm Now that we are familiar with bridges, we can use a technique called Fleury’s algorithm, which is a series of steps, or algorithm, used to find an Euler trail in any graph that has exactly two vertices of odd degree. Here are the steps involved in applying Fleury’s algorithm. Here are the steps involved in applying Fleury’s algorithm. Step 1: Begin at either of the two vertices of odd degree. Step 2: Remove an edge between the vertex and any adjacent vertex that is NOT a bridge, unless there is no other choice, making a note of the edge you removed. Repeat this step until all edges are removed. Step 3: Write out the Euler trail using the sequence of vertices and edges that you found. For example, if you removed ab, bc, cd, de, and ef, in that order, then the Euler trail is a → b → c → d → e → f. Figure 12.161 shows the steps to find an Euler trail in a graph using Fleury’s algorithm. Figure 12.161 Using Fleury’s Algorithm To Find Euler Trail The Euler trail that was found in Figure 12.161 is t → v → w → u → t → w → y → x → v. Example 12.31: Finding an Euler Trail with Fleury’s Algorithm Use Fleury’s Algorithm to find an Euler trail for Graph J in Figure 12.162. Figure 12.162: Graph J Answer Step 1: Choose one of the two vertices of odd degree, c or f, as your starting vertex. We will choose c. Step 2: Remove edge ca, cb, or cd. None of these are cut edges so we can select any of the three. We will choose cb as shown in Figure 12.163 to be the first edge removed. Figure 12.163 Graph J with cb RemovedRepeat Step 2 The next choice is to remove edge ba, bd, or bf as shown in Figure 12.163, but bf is not an option since it is a bridge. We will choose ba as shown in Figure 12.164 to be the second edge removed. Figure 12.164 Graph J with cb and ba RemovedRepeat Step 2 for the third, fourth, fifth, sixth, and seventh edges. As shown in Figure 12.164, until we get to the seventh edge there is only one option each time, ac, cd, db, and bf in that order. For the seventh edge, we must choose between fe and fg. Neither of these are bridges. We choose fe. Figure 12.165 shows that ac, cd, db, bf, and fe have been removed. Figure 12.165 Graph J with Seven Edges RemovedStep 3: Write out the Euler trail using the vertices in the sequence that the edges were removed. We removed cb, ba, ac, cd, db, bf, fe, eh, hi, ig, and gf, in that order. The Euler trail is c → b → a → c → d → b → f → e → h → i → g → f. Checkpoint TIP! To avoid errors, count the number of edges in your graph and make sure thatyour Euler trail represents that number of edges. Your Turn 12.31 Use Graph L to fill in the blanks to complete the steps in Fleury’s algorithm. Figure 12.166: Graph L The two vertices that can be used as the starting vertex are ____ and s. If sq is the first edge removed, the three options for the second edge to be removed are qr, ___, and ___; however, ___ cannot be chosen because it is a ________________. If qr is the second edge removed, the next four edges to be removed must be ___, ___, ___, and ___, in that order. After qn is removed, the three options for the next edge to be removed are no, ___, and ___, however, ___ cannot be chosen because it is a _____________. If no is the next edge removed, the last four edges removed will be ___, ___, ___, and ___, in that order. The final Euler trail using the answers to parts 1 through 5 is _________________________. In the previous section, we found Euler circuits using an algorithm that involved joining circuits together into one large circuit. You can also use Fleury’s algorithm to find Euler circuits in any graph with vertices of all even degree. In that case, you can start at any vertex that you would like to use. Step 1: Begin at any vertex. Step 2: Remove an edge between the vertex and any adjacent vertex that is NOT a bridge, unless there is no other choice, making a note of the edge you removed. Repeat this step until all edges are removed. Step 3: Write out the Euler circuit using the sequence of vertices and edges that you found. For example, if you removed ab, bc, cd, de, and ea, in that order, then the Euler circuit is a → b → c → d → e → a. Video Fluery's Algorithm to Find an Euler Circuit Checkpoint IMPORTANT! Since a circuit is a closed trail, every Euler circuit is also an Euler trail, but when we say Euler trail in this chapter, we are referring to an open Euler trail that begins and ends at different vertices. Example 12.32: Finding an Euler Circuit or Euler Trail Using Fleury’s Algorithm Use Fleury’s algorithm to find either an Euler circuit or Euler trail in Graph G in Figure 12.167. Figure 12.167: Graph G Answer Graph G has all vertices of even degree so it has an Euler circuit. Step 1: Choose any vertex. We will choose vertex j. Step 2: Remove one of the four edges that meet at vertex j. Since jn is a bridge, we must remove either jh, ji, or jk. We remove ji as shown in Figure 12.168. Figure 12.168 Graph G with 1 Edge RemovedRepeat Step 2: Since id is a bridge, we can remove either ih or ik next. We remove ih, and then the only option is to remove hj as shown in Figure 12.169. Figure 12.169 Graph G with 3 Edges RemovedRepeat Step 2: Since jn is a bridge, the next edge removed must be jk, and then the only option is to remove ki followed by id as shown in Figure 12.169. Even though id is a bridge, it can be removed because it is the only option at this point. Figure 12.170 shows Graph G with these additional edges removed. Figure 12.170 Graph G with 6 Edges RemovedRepeat Step 2: Choose any one of the edges db, dc, or de. We remove dc as shown in Figure 12.171. Figure 12.171 Graph G with 7 Edges RemovedRepeat Step 2: Since co is a bridge, choose cb next. We remove cb, then bd, and then de as shown in Figure 12.172. Figure 12.172 Graph G with 10 Edges RemovedRepeat Step 2: Next, remove ec and co. Then choose any of op, pn, or om. We remove on as shown in Figure 12.173. Figure 12.173 Graph G with 13 Edges RemovedRepeat Step 2: Next, remove either nm, np, or nj, but nj is a So, we remove nm as shown in Figure 12.174. Figure 12.174 Graph G with 14 Edges RemovedRepeat Step 2: Next, remove mo, op, pn, and nj. And we are done! Step 3: Notice that the algorithm brought us back to the vertex where we started, forming an Euler circuit. Write out the Euler circuit: j → i → h → j → k → i → d → c → b → d → e → c → o → n → m → o → p → n → j Your Turn 12.32 Find an Euler circuit or trail through the graph using Fleury’s algorithm. Figure 12.175: Graph T WORK IT OUT We have discussed a lot of subtle concepts in this section. Let’s make sure we are all on the same page. Work with a partner to explain why each of the following facts about bridges are true. Support your explanations with definitions and graphs. When a bridge is removed from a graph, the number of components increases. A bridge is never part of a circuit. An edge that is part of a triangle is never a local bridge. Check Your Understanding Fill in the blank to make the statement true. An Euler trail is a trail that visits each ___________ exactly once. __________ algorithm is a procedure for finding an Euler trail or circuit. An Euler _____ always begins and ends at the same vertex, but an Euler _____ does not. When a bridge is removed from a graph, the number of ________ is increased by one. When a __________ is removed from a graph, the shortest path between its vertices will be greater than two. When using Fleury’s algorithm to find an Euler trail, never remove a _________ unless it is the only option. Section 12.6 Exercises Use the figure to answer the following exercises. Identify the graph(s) with the given characteristics, if any. 1. Connected 2. All vertices of even degree 3. Exactly two vertices of odd degree 4. Has an Euler trail 5. Has an Euler circuit 6. Has neither an Euler trail nor an Euler circuit 7. ab is a bridge 8. ef is a bridge 9. ab is a local bridge 10. ef is a local bridge Use the figure to answer the following exercises. In each exercise, a graph and a sequence of vertices are given. Determine whether each sequence of vertices is an Euler trail, an Euler circuit, or neither for the graph. If it is neither, explain why. Figure 12.176 11. Graph A, w → x → y → z → w → u → t → s → v → u 12. Graph A, u → v → s → t → u → w → z → y → x → w 13. Graph A, s → t → u → v → u → w → z → y → x → w 14. Graph A, w → x → y → z → w → v → u → t → s → v 15. Graph B, u → v → w → x → r → u → t → s → y → z → u 16. Graph B, v → w → x → r → u → z → y → s → t → u 17. Graph C, s → t → u → v → w → x → s 18. Graph C, t → u → x → w → u → s → t → v → w 19. Graph D, t → r → s → t → u → v → t → x → v → w → x → y → z → x 20. Graph D, x → v → w → x → y → z → x → t → r → s → t → u → v → t Use the figure to answer the following exercises. For each graph, identify a bridge if one exists. If it does not, state so. If it does, identify any components that are created when the bridge is removed. 21. Graph A 22. Graph B 23. Graph C 24. Graph D Use the figuree to answer the following exercises. For each graph, identify a local bridge if one exists. If it does not, state so. If it does, find a shortest path between the vertices of the local bridge if the local bridge is removed. 25. Graph A 26. Graph B 27. Graph C 28. Graph D Use the graphs to answer the following exercises. In each exercise, a graph is given. Find two Euler trails in each graph using Fleury’s algorithm. 29. Graph Q 30. Graph R 31. Graph S 32. In chess, a knight can move in any direction, but it must move two spaces then turn and move one more space. The eight possible moves a knight can make from a given space are shown in the figure. A graph in which each vertex represents a space on a five-by-six game board and each edge represents a move a knight could make is shown in the figure. A knight’s tour is a sequence of moves by a knight on a chessboard (of any size) such that the knight visits every square exactly once. If the knight’s tour brings the knight back to its starting position on the board, it is called a closed knight’s tour. Otherwise, it is called an open knight’s tour. Determine if the closed knight’s tour in the figure is most accurately described as a trail, a circuit, an Euler trail, or an Euler circuit of the graph of all possible knight moves. Explain your reasoning. 33. Determine if the open knight’s tour in the figure is most accurately described as a trail, a circuit, an Euler trail, or an Euler circuit of the graph of all possible knight moves on a five-by-five game board. Explain your reasoning. 34. The neighborhood of Pines West has three cul-de-sacs that meet at an intersection as shown in the figure. A postal delivery person starts at the intersection and visits each house in a cul-de-sac once, returns to the intersection, visits each house in the next cul-de-sac, and so on, returning to the intersection when finished. Describe how the route can be represented as a graph. If there is no backtracking, in other words, the person never reverses direction, is the route followed by the postal delivery person best described as a trail, a circuit, an Euler trail, or an Euler circuit? Explain your reasoning. 35. Recall that the bridges of Konigsberg can be represented as a multigraph as shown in the figure. We have seen that no route through Konigsberg passes over each bridge exactly once and returns to the starting point. Is there a route that passes over each bridge exactly once but does not begin and end at the same point? Explain your reasoning. 36. The figure shows the map of the exhibits at an indoor aquarium. Use a graph in which the edges represent hallways and the vertices represent turns and intersections to explain why a visitor to the aquarium cannot start at one of the turns or intersections, passes by every exhibit exactly once, and end at one of the turns or intersections. 37. The map of the states of Imaginaria is given. Use a graph to determine if it is possible to begin in one state, travel through Imaginaria crossing the border between each pair of states exactly once, and end in a different state. If it is possible, find such a route. If it is not, explain why.