maths.free › Combinatorics & Graph Theory › 3. Graph Theory › Euler Trails and Circuits
Euler Trails and Circuits
Investigation A spider is standing on one face of an octahedron (a polyhedron with eight triangular faces). She wants to crawl along the solid from face to face so that she crosses each edge exactly once.
Section Preview
Investigation
A spider is standing on one face of an octahedron (a polyhedron with eight triangular faces). She wants to crawl along the solid from face to face so that she crosses each edge exactly once. Is this possible? If so, how?
If we start at a vertex and trace along edges to get to other vertices, we create a walk through the graph. More precisely, a walk in a graph is a sequence of vertices such that every vertex in the sequence is adjacent to the vertices before and after it in the sequence. If the walk travels along every edge exactly once, then the walk is called an Euler trail (or Euler walk or Euler path). If, in addition, the starting and ending vertices are the same (so you trace along every edge exactly once and end up where you started), then the walk is called an Euler circuit (or Euler tour). Of course if a graph is not connected, there is no hope of finding such a trail or circuit. For the rest of this section, assume all the graphs discussed are connected.
The bridges of Königsberg problem is really a question about the existence of Euler trails. There will be a route that crosses every bridge exactly once if and only if the multigraph below has an Euler trail:
This graph is small enough that we could actually check every possible walk that does not reuse edges, and in doing so convince ourselves that there is no Euler trail (let alone an Euler circuit). On small graphs that do have an Euler trail, it is usually not difficult to find one. Our goal is to find a quick way to check whether a graph has an Euler trail or circuit, even if the graph is quite large.
Conditions for Euler Trails
One way to guarantee that a graph does not have an Euler circuit is to include a spike, a vertex of degree 1.
The vertex \(a\) has degree 1, and if you try to make an Euler circuit, you see that you will get stuck at the vertex. It is a dead end. That is, unless you start there. But then there is no way to return, so there is no hope of finding an Euler circuit. There is however an Euler trail. It starts at the vertex \(a\), then loops around the triangle. You will end at the vertex of degree 3.
You run into a similar problem whenever you have a vertex of any odd degree. If you start at such a vertex, you will not be able to end there (after traversing every edge exactly once). After using one edge to leave the starting vertex, you will be left with an even number of edges emanating from the vertex. Half of these could be used for returning to the vertex, the other half for leaving. So you return, then leave. Return, then leave. The only way to use up all the edges is to use the last one by leaving the vertex. On the other hand, if you have a vertex with odd degree at which you do not start a trail, then you will eventually get stuck at that vertex. The trail will use pairs of edges incident to the vertex to arrive and leave again. Eventually all but one of these edges will be used up, leaving only an edge to arrive by, and none to leave again.
What all this says is that if a graph has an Euler trail and two vertices with odd degree, then the Euler trail must start at one of the odd-degree vertices and end at the other. In such a situation, every other vertex must have an even degree since we need an equal number of edges to get to those vertices as to leave them. How could we have an Euler circuit? The graph could not have any odd-degree vertex as an Euler trail would have to start there or end there, but not both. Thus for a graph to have an Euler circuit, all vertices must have even degree.
The converse is also true: if all the vertices of a graph have even degree, then the graph has an Euler circuit, and if there are exactly two vertices with odd degree, the graph has an Euler trail. To prove this is a little tricky, but the basic idea is that you will never get stuck because there is an outbound edge for every inbound edge at every vertex. If you try to make an Euler trail and miss some edges, you will always be able to splice in a circuit using the edges you previously missed.
A graph has an Euler circuit if and only if the degree of every vertex is even.
A graph has an Euler trail if and only if there are at most two vertices with odd degree.
Condensed — the full section is in Levin, Discrete Mathematics: An Open Introduction.
Hamilton Paths
Suppose you wanted to tour Königsberg in such a way that you visit each land mass (the two islands and both banks) exactly once. This can be done. In graph theory terms, we are asking whether there is a path that visits every vertex exactly once. Such a path is called a Hamilton path (or Hamiltonian path). We could also consider Hamilton cycles, which are Hamilton paths that start and stop at the same vertex.
Example
Determine whether the graphs below have a Hamilton path.
Solution
The graph on the left has a Hamilton path (many different ones, actually), as shown here:
The graph on the right does not have a Hamilton path. You would need to visit each of the outside vertices, but as soon as you visit one, you get stuck. Note that this graph does not have an Euler trail, although there are graphs with Euler trails but no Hamilton paths.
It appears that finding Hamilton paths would be easier because graphs often have more edges than vertices, so there are fewer requirements to be met. However, nobody knows whether this is true. There is no known simple test for whether a graph has a Hamilton path. For small graphs this is not a problem, but as the size of the graph grows, it gets harder and harder to check whether there is a Hamilton path. In fact, this is an example of a question which as far as we know is too difficult for computers to solve in general, as it is an example of a problem that is NP-complete.
Practice (19)
Try each one on paper first. Reveal the answer to check; verified ones can be opened in the solver for every step.
-
Is there a graph that has an Euler circuit but not an Euler trail? Explain your answer.
-
Can a tree have an Euler trail? Can a tree have an Euler circuit? Explain your answers.
-
What questions do you have after reading this section? Write at least one question about the content of this section that you are curious about.
-
Find an Euler trail in the following graph.
-
Which of the graphs below have an Euler circuit? If a graph has an Euler circuit, find it.
Mutasd meg a választ!
Only (b) has an Euler circuit. The graph in (a) is not connected, so even though every vertex has even degree, it does not have an Euler circuit. (c) has two vertices of odd degree, so it does not have an Euler circuit.
One Euler circuit for (b) is \[(a,d,f,e,g,c,b,e,h,b,i,c,f,a)\].
-
Determine which of the following graphs have an Euler circuit or an Euler trail.
\[\begin{aligned}V = \amp \{a,b,c,d,e,f\} \\ E = \amp \{ab, af, bc, cd, ce, cf, de, ef\}\end{aligned}\]
The graph given by the adjacency list:
u v,w,y,z v u,w,x,y w u,v,x,z x v,w,y,z y u,v,x,z z u,w,x,y The graph given by the adjacency matrix: \[\begin{pmatrix} 0 \amp 1 \amp 1 \amp 0 \amp 0 \amp 1 \\ 1 \amp 0 \amp 1 \amp 1 \amp 0 \amp 0 \\ 1 \amp 1 \amp 0 \amp 0 \amp 1 \amp 0 \\ 0 \amp 1 \amp 0 \amp 0 \amp 1 \amp 1 \\ 0 \amp 0 \amp 1 \amp 1 \amp 0 \amp 1 \\ 1 \amp 0 \amp 0 \amp 1 \amp 1 \amp 0 \end{pmatrix}\]
Mutasd meg a választ!
The first graph has an Euler trail, but not an Euler circuit. The second graph has an Euler circuit. The third graph has neither an Euler circuit nor an Euler trail. You can see this by drawing the graphs, but also by finding the degrees of the vertices.
-
Add an edge to the following graph (between a pair of vertices that are not already adjacent) to make it have an Euler trail. Then find the Euler trail.
-
You and your friends want to tour the southwest by car. You will visit the nine states below, with the following rather odd rule: You must cross each border between neighboring states exactly once (so, for example, you must cross the Colorado-Utah border exactly once). Can you do it? If so, does it matter where you start your road trip? What fact about graph theory solves this problem?
Mutasd meg a választ!
This is a question about finding Euler trails. Draw a graph with a vertex in each state, and connect vertices if their states share a border. Exactly two vertices will have odd degree, the vertices for Nevada and Utah. Thus you must start your road trip at in one of those states and end it in the other.
-
Which of the following graphs contain an Euler trail? Which contain an Euler circuit?
- \(K_4\)
- \(K_5\)
- \(K_{5,7}\)
- \(K_{2,7}\)
- \(C_7\)
- \(P_7\)
Mutasd meg a választ!
- \(K_4\)
- \(K_5\)
- \(K_{5,7}\)
- \(K_{2,7}\)
- \(C_7\)
- \(P_7\)
-
Edward A. Mouse has just finished his brand new house. The floor plan is shown below:
Edward wants to give a tour of his new pad to a lady-mouse friend. Is it possible for them to walk through every doorway exactly once? If so, in which rooms must they begin and end the tour? Explain.
Is it possible to tour the house visiting each room exactly once (not necessarily using every doorway)? Explain.
After a few mouse-years, Edward decides to remodel. He would like to add some new doors between the rooms he has. Of course, he cannot add any doors to the exterior of the house. Is it possible for each room to have an odd number of doors? Explain.
-
For which \(n\) does the graph \(K_n\) contain an Euler circuit? Explain.
-
For which \(m\) and \(n\) does the graph \(K_{m,n}\) contain an Euler trail? An Euler circuit? Explain.
-
For which \(n\) does \(K_n\) contain a Hamilton path? A Hamilton cycle? Explain.
-
For which \(m\) and \(n\) does the graph \(K_{m,n}\) contain a Hamilton path? A Hamilton cycle? Explain.
Mutasd meg a választ!
Hint:
This is harder than the previous three questions. Think about which side of the graph the Hamilton path would need to be on at every other step.
-
A bridge builder has come to Königsberg and would like to add bridges so that it is possible to travel over every bridge exactly once. How many bridges must be built?
Mutasd meg a választ!
If we build one bridge, we can have an Euler trail. Two bridges must be built for an Euler circuit.
-
Below is a graph representing friendships between a group of students (each vertex is a student and each edge is a friendship). Is it possible for the students to sit around a round table in such a way that every student sits between two friends? What does this question have to do with trails?
Mutasd meg a választ!
Hint:
If you read off the names of the students in order, you would need to read each student's name exactly once, and the last name would need to be of a student who was friends with the first. What sort of a cycle is this?
-
On the table rest 8 dominoes, as shown below. If you were to line them up in a single row, so that any two sides touching had matching numbers, what would the sum of the two end numbers be?
Mutasd meg a választ!
Hint:
Draw a graph with 6 vertices and 8 edges. What sort of walk would be appropriate?
-
Is there anything we can say about whether a graph has a Hamilton path based on the degrees of its vertices?
Suppose a graph has a Hamilton path. What is the maximum number of vertices of degree one the graph can have? Explain why your answer is correct.
Find a graph that does not have a Hamilton path even though no vertex has degree one. Explain why your example works.
-
Consider the following graph:
- Find a Hamilton path. Can your path be extended to a Hamilton cycle?
- part
- Use your answer to part (b) to prove that the graph has no Hamilton cycle.
- \(G\)\(G\)
Symbols used here
A rectangular array of numbers; a linear map.
n × (n−1) × … × 1; the number of orderings of n things. 0! = 1.
Number of k-element subsets of n things: n!/(k!(n−k)!).
Add a_k for k = 1 up to n.
Multiply a_k for k = 1 up to n.
The set with no elements; the number of elements of A.
How to: Euler Trails and Circuits
- Identify whether a graph or multigraph has an Euler trail or circuit.
- Justify why the necessary condition for a graph having an Euler trail is necessary.
- Distinguish between Euler trails and Hamilton paths, and decide which is more appropriate to use for a given problem.
Questions people ask
Permutation or combination?
Ask whether order matters. A lock code is a permutation (order matters); a hand of cards is a combination (it does not).
What is a graph in this sense?
Dots (vertices) joined by lines (edges) — not a plot. Road maps, social networks and molecules are graphs; questions like "is there a route" and "how few colours" are graph theory.
Próbáld a sajátodat.
Parts of this page are adapted from Levin, Discrete Mathematics: An Open Introduction (CC BY-SA 4.0). Condensed and re-explained here; errors are ours.
Még több Combinatorics & Graph Theory
The counting principlesPigeonhole principle and inclusion–exclusionBinomial coefficients and Pascal's triangleRecurrences and generating functionsGraphs: vertices, edges, degreesPaths, cycles, trees, Euler and HamiltonColouring and planar graphs