Top Banner
11.2 Eulerian Trails
40

11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Apr 05, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

11.2 Eulerian Trails

Page 2: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

K..onigsberg, 1736

Page 3: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Graph Representation

•A

B• •C

•D

Page 4: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Do You Remember ...

DefinitionA u− v trail is a u− v walk where no edge is repeated.

DefinitionA circuit is a nontrivial closed trail.

Page 5: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Do You Remember ...

DefinitionA u− v trail is a u− v walk where no edge is repeated.

DefinitionA circuit is a nontrivial closed trail.

Page 6: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

New Definitions

DefinitionAn Eulerian trail is an open trail of G containing all edges andvertices.

DefinitionAn Eulerian circuit is a closed trail containing all edges and vertices.

DefinitionA graph containing an Eulerian circuit is called Eulerian.

Page 7: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

New Definitions

DefinitionAn Eulerian trail is an open trail of G containing all edges andvertices.

DefinitionAn Eulerian circuit is a closed trail containing all edges and vertices.

DefinitionA graph containing an Eulerian circuit is called Eulerian.

Page 8: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

New Definitions

DefinitionAn Eulerian trail is an open trail of G containing all edges andvertices.

DefinitionAn Eulerian circuit is a closed trail containing all edges and vertices.

DefinitionA graph containing an Eulerian circuit is called Eulerian.

Page 9: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Examples

Which contain Eulerian trails? circuits?

Do you see any patterns as to when one does/does not exist?

Page 10: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

More Examples

Page 11: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Conclusions

1 If all vertices are even, an Eulerian circuit exists

2 If there are exactly 2 odd vertices, an Eulerian trail exists thatbegins at one odd vertex and ends at the other one

3 If there are more than two odd vertices, no Eulerian trail orcircuit exists

Page 12: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Conclusions

1 If all vertices are even, an Eulerian circuit exists2 If there are exactly 2 odd vertices, an Eulerian trail exists that

begins at one odd vertex and ends at the other one

3 If there are more than two odd vertices, no Eulerian trail orcircuit exists

Page 13: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Conclusions

1 If all vertices are even, an Eulerian circuit exists2 If there are exactly 2 odd vertices, an Eulerian trail exists that

begins at one odd vertex and ends at the other one3 If there are more than two odd vertices, no Eulerian trail or

circuit exists

Page 14: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Necessary Condition

TheoremA graph G contains an Eulerian circuit if and and only if the degree ofeach vertex is even.

Proof of necessity: Suppose G contains an Eulerian circuit C. Then,for any choice of vertex v, C contains all the edges that are incident tov. Furthermore, as we traverse along C, we must enter and leave v thesame number of times, and it follows that deg(v) must be even.

Page 15: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Necessary Condition

TheoremA graph G contains an Eulerian circuit if and and only if the degree ofeach vertex is even.

Proof of necessity: Suppose G contains an Eulerian circuit C. Then,for any choice of vertex v, C contains all the edges that are incident tov. Furthermore, as we traverse along C, we must enter and leave v thesame number of times, and it follows that deg(v) must be even.

Page 16: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Example

K5 is 4-regular and so has all even vertices.

��

��• //

<<

vv ��start•

OO

EE

hh

oo

Page 17: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Notes

Euler presented proof of necessity in 1736

His paper did not include the proof of the converse

Proof of sufficiency was presented in 1873 by a Germanmathematician named Carl Hierholzer

Page 18: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Proof of Sufficiency

We prove by induction on the number of edges. For graphs with allvertices of even degree, the smallest possible number of edges is 3 inthe case of simple graphs, and 2 in the case of multigraphs. In bothcases, the graph trivially contains an Eulerian circuit.

The inductionhypothesis then says:

Let H be a connected graph with k edges. If every vertex ofH has even degree, H contains an Eulerian circuit.

Now, let G be a graph with k + 1 edges, and every vertex has an evendegree. Since there is no odd degree vertex, G cannot be a tree. Thus,G must contain a cycle C.

Page 19: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Proof of Sufficiency

We prove by induction on the number of edges. For graphs with allvertices of even degree, the smallest possible number of edges is 3 inthe case of simple graphs, and 2 in the case of multigraphs. In bothcases, the graph trivially contains an Eulerian circuit. The inductionhypothesis then says:

Let H be a connected graph with k edges. If every vertex ofH has even degree, H contains an Eulerian circuit.

Now, let G be a graph with k + 1 edges, and every vertex has an evendegree. Since there is no odd degree vertex, G cannot be a tree. Thus,G must contain a cycle C.

Page 20: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Proof of Sufficiency

We prove by induction on the number of edges. For graphs with allvertices of even degree, the smallest possible number of edges is 3 inthe case of simple graphs, and 2 in the case of multigraphs. In bothcases, the graph trivially contains an Eulerian circuit. The inductionhypothesis then says:

Let H be a connected graph with k edges. If every vertex ofH has even degree, H contains an Eulerian circuit.

Now, let G be a graph with k + 1 edges, and every vertex has an evendegree. Since there is no odd degree vertex, G cannot be a tree. Thus,G must contain a cycle C.

Page 21: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Proof of Sufficiency (cont.)

Now, remove the edges of C from G, and consider the remaininggraph G′. Since removing C from G may disconnect the graph, G′ is acollection of connected components, namely G1,G2, . . ..

Furthermore, when the edges in C are removed from G, each vertexloses even number of adjacent edges. Thus, the parity of each vertexis unchanged in G′. It follows that, for each connected component ofG′, every vertex has an even degree.

Therefore, by the induction hypothesis, each of G1,G2, . . . has itsown Eulerian circuit, namely C1,C2, . . ..

Page 22: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Proof of Sufficiency (cont.)

Now, remove the edges of C from G, and consider the remaininggraph G′. Since removing C from G may disconnect the graph, G′ is acollection of connected components, namely G1,G2, . . ..

Furthermore, when the edges in C are removed from G, each vertexloses even number of adjacent edges. Thus, the parity of each vertexis unchanged in G′. It follows that, for each connected component ofG′, every vertex has an even degree.

Therefore, by the induction hypothesis, each of G1,G2, . . . has itsown Eulerian circuit, namely C1,C2, . . ..

Page 23: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Proof of Sufficiency (cont.)

Now, remove the edges of C from G, and consider the remaininggraph G′. Since removing C from G may disconnect the graph, G′ is acollection of connected components, namely G1,G2, . . ..

Furthermore, when the edges in C are removed from G, each vertexloses even number of adjacent edges. Thus, the parity of each vertexis unchanged in G′. It follows that, for each connected component ofG′, every vertex has an even degree.

Therefore, by the induction hypothesis, each of G1,G2, . . . has itsown Eulerian circuit, namely C1,C2, . . ..

Page 24: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Proof of Sufficiency (cont.)

We can now build an Eulerian circuit for G. Pick an arbitrary vertex afrom C. Traverse along C until we reach a vertex vi that belongs toone of the connected components Gi.

Then, traverse along its Eulerian circuit Ci until we traverse all theedges of Ci. We are now back at vi, and so we can continue on alongC. In the end, we shall return back to the first starting vertex a, aftervisiting every edge exactly once.

Page 25: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Proof of Sufficiency (cont.)

We can now build an Eulerian circuit for G. Pick an arbitrary vertex afrom C. Traverse along C until we reach a vertex vi that belongs toone of the connected components Gi.

Then, traverse along its Eulerian circuit Ci until we traverse all theedges of Ci. We are now back at vi, and so we can continue on alongC. In the end, we shall return back to the first starting vertex a, aftervisiting every edge exactly once.

Page 26: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Illustration of Theorem

• • •

• • • • • • •

• • •

• • •

• • • • • • •

• • •

Page 27: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Illustration of Theorem

• • •

• • • • • • •

• • •

• • •

• • • • • • •

• • •

Page 28: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Illistration of Theorem (cont..)

• • •

• • • • • • •

• • •

• • •

"*

• • • • • •

• • •

Page 29: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Illistration of Theorem (cont..)

• • •

• • • • • • •

• • •

• • •

"*

• • • • • •

• • •

Page 30: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Illistration of Theorem (cont..)

• • •

• • • • • • •

• • •

• • •

• • • • • • •

• +3 • •

Page 31: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Illistration of Theorem (cont..)

• • •

• • • • • • •

• • •

• • •

• • • • • • •

• +3 • •

Page 32: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Fleury’s Algorithm

1 Check if the graph is connected, and every vertex is of evendegree. Reject otherwise.

2 Pick any vertex vstart to start.3 While the graph contains at least one edge:

1 Pick an edge that is not a bridge.2 Traverse that edge, and remove it from G.

Definitiona bridge is an edge whose removal makes a connected graph becomedisconnected.

Page 33: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Fleury’s Algorithm

1 Check if the graph is connected, and every vertex is of evendegree. Reject otherwise.

2 Pick any vertex vstart to start.3 While the graph contains at least one edge:

1 Pick an edge that is not a bridge.2 Traverse that edge, and remove it from G.

Definitiona bridge is an edge whose removal makes a connected graph becomedisconnected.

Page 34: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Proof of Correctness

To see that this algorithm terminates, suppose we are stuck at somevertex v before all the edges are removed. Then either v must have anodd degree, or G is not a connected graph to begin with. Both of thesecases are impossible due to our first check. This is a contradiction.Note that, when the algorithm terminates, we must return to vstart

because every vertex has an even degree. Furthermore, the edgeremoval operation guarantees that each edge is visited exactly once.Therefore, the discovered tour is an Eulerian circuit.

Page 35: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Eulerian trail

TheoremA graph contains an Eulerian path if and only if there are 0 or 2 odddegree vertices.

Suppose a graph G contains an Eulerian path P. Then, for everyvertex v, P must enter and leave v the same number of times, exceptwhen it is either the starting vertex or the final vertex of P. When thestarting and final vertices are distinct, there are precisely 2 odd degreevertices. When these two vertices coincide, there is no odd degreevertex.Conversely, suppose G contains 2 odd degree vertex u and v. (Thecase where G has no odd degree vertex is shown in the previoustheorem.) Then, temporarily add a dummy edge {u, v} to G. Now themodified graph contains no odd degree vertex. By the last theorem,this graph contains an Eulerian circuit C that also contains {u, v}.Remove {u, v} from C, and now we have an Eulerian path where uand v serve as initial and final vertices.

Page 36: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Eulerian trail

TheoremA graph contains an Eulerian path if and only if there are 0 or 2 odddegree vertices.

Suppose a graph G contains an Eulerian path P. Then, for everyvertex v, P must enter and leave v the same number of times, exceptwhen it is either the starting vertex or the final vertex of P. When thestarting and final vertices are distinct, there are precisely 2 odd degreevertices. When these two vertices coincide, there is no odd degreevertex.

Conversely, suppose G contains 2 odd degree vertex u and v. (Thecase where G has no odd degree vertex is shown in the previoustheorem.) Then, temporarily add a dummy edge {u, v} to G. Now themodified graph contains no odd degree vertex. By the last theorem,this graph contains an Eulerian circuit C that also contains {u, v}.Remove {u, v} from C, and now we have an Eulerian path where uand v serve as initial and final vertices.

Page 37: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Eulerian trail

TheoremA graph contains an Eulerian path if and only if there are 0 or 2 odddegree vertices.

Suppose a graph G contains an Eulerian path P. Then, for everyvertex v, P must enter and leave v the same number of times, exceptwhen it is either the starting vertex or the final vertex of P. When thestarting and final vertices are distinct, there are precisely 2 odd degreevertices. When these two vertices coincide, there is no odd degreevertex.Conversely, suppose G contains 2 odd degree vertex u and v. (Thecase where G has no odd degree vertex is shown in the previoustheorem.) Then, temporarily add a dummy edge {u, v} to G. Now themodified graph contains no odd degree vertex. By the last theorem,this graph contains an Eulerian circuit C that also contains {u, v}.Remove {u, v} from C, and now we have an Eulerian path where uand v serve as initial and final vertices.

Page 38: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Chinese Postman Problem

Kwan, 1962A mail carrier starting out at the post office must deliver letters toeach block in a territory and return to the post office. What is the leastnumber of repeated street necessary?

• • •

• • •

• • •

Page 39: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Chinese Postman Problem

Kwan, 1962A mail carrier starting out at the post office must deliver letters toeach block in a territory and return to the post office. What is the leastnumber of repeated street necessary?

• • •

• • •

• • •

Page 40: 11.2 Eulerian Trails - Dr. Travers Page of Mathbtravers.weebly.com/.../2/9/6729909/11.2_eulerian_trails.pdf · 2020-02-06 · Proof of Sufficiency We prove by induction on the number

Chinese Postman Problem (cont.)

• // • //

��

VV •

• oo •66 •

• • •Edges must be added to create a multigraph because the simple graphcontains no Eulerian circuit.