Section 14 2 Euler Paths and Euler Circuits

  • Slides: 24
Download presentation
Section 14. 2 Euler Paths, and Euler Circuits Copyright 2013, 2010, 2007, Pearson, Education,

Section 14. 2 Euler Paths, and Euler Circuits Copyright 2013, 2010, 2007, Pearson, Education, Inc.

What You Will Learn Euler Paths Euler Circuits Euler’s Theorem Fleury’s Algorithm 14. 2

What You Will Learn Euler Paths Euler Circuits Euler’s Theorem Fleury’s Algorithm 14. 2 -2 Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Euler Path An Euler path is a path that passes through each edge of

Euler Path An Euler path is a path that passes through each edge of a graph exactly one time. 14. 2 -3 Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Euler Circuit An Euler circuit is a circuit that passes through each edge of

Euler Circuit An Euler circuit is a circuit that passes through each edge of a graph exactly one time. 14. 2 -4 Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Euler Path versus Euler Circuit The difference between an Euler path and an Euler

Euler Path versus Euler Circuit The difference between an Euler path and an Euler circuit is that an Euler circuit must start and end at the same vertex. 14. 2 -5 Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Euler Path versus Euler Circuit Euler Path D, E, B, C, A, B, D,

Euler Path versus Euler Circuit Euler Path D, E, B, C, A, B, D, C, E Euler Circuit D, E, B, C, A, B, D, C, E, F, D 14. 2 -6 Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Euler’s Theorem For a connected graph, the following statements are true: 1. A graph

Euler’s Theorem For a connected graph, the following statements are true: 1. A graph with no odd vertices (all even vertices) has at least one Euler path, which is also an Euler circuit. An Euler circuit can be started at any vertex and it will end at the same vertex. 14. 2 -7 Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Euler’s Theorem 2. A graph with exactly two odd vertices has at least one

Euler’s Theorem 2. A graph with exactly two odd vertices has at least one Euler path but no Euler circuits. Each Euler path must begin at one of the two odd vertices, and it will end at the other odd vertex. 3. A graph with more than two odd vertices has neither an Euler path nor an Euler circuit. 14. 2 -8 Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Example 3: Solving the Königsberg Bridge Problem Could a walk be taken through Königsberg

Example 3: Solving the Königsberg Bridge Problem Could a walk be taken through Königsberg during which each bridge is crossed exactly one time? 14. 2 -9 Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Example 3: Solving the Königsberg Bridge Problem Solution Here’s a representation of the problem:

Example 3: Solving the Königsberg Bridge Problem Solution Here’s a representation of the problem: vertices are the land, edges are the bridges. 14. 2 -10 Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Example 3: Solving the Königsberg Bridge Problem Solution Does an Euler path exist? Four

Example 3: Solving the Königsberg Bridge Problem Solution Does an Euler path exist? Four odd vertices: A, B, C, D So, according to item 3 of Euler’s Theorem, no Euler path exists. 14. 2 -11 Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Fleury’s Algorithm To determine an Euler path or an Euler circuit 1. Use Euler’s

Fleury’s Algorithm To determine an Euler path or an Euler circuit 1. Use Euler’s theorem to determine whether an Euler path or an Euler circuit exists. If one exists, proceed with steps 2 -5. 14. 2 -12 Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Fleury’s Algorithm 2. If the graph has no odd vertices (therefore has an Euler

Fleury’s Algorithm 2. If the graph has no odd vertices (therefore has an Euler circuit, which is also an Euler path), choose any vertex as the starting point. If the graph has exactly two odd vertices (therefore has only an Euler path), choose one of the two odd vertices as the starting point. 14. 2 -13 Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Fleury’s Algorithm 3. Begin to trace edges as you move through the graph. Number

Fleury’s Algorithm 3. Begin to trace edges as you move through the graph. Number the edges as you trace them. Since you can’t trace any edges twice in Euler paths and Euler circuits, once an edge is traced consider it “invisible. ” 14. 2 -14 Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Fleury’s Algorithm 4. When faced with a choice of edges to trace, if possible,

Fleury’s Algorithm 4. When faced with a choice of edges to trace, if possible, choose an edge that is not a bridge (i. e. , don’t create a disconnected graph with your choice of edges). 5. Continue until each edge of the entire graph has been traced once. 14. 2 -15 Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Example 6: Crime Stoppers Problem On the next slide is a representation of the

Example 6: Crime Stoppers Problem On the next slide is a representation of the Country Oaks subdivision of homes. The Country Oaks Neighborhood Association is planning to organize a crime stopper group in which residents take turns walking through the neighborhood with cell phones to report any suspicious activity to the police. 14. 2 -16 Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Example 6: Crime Stoppers Problem 14. 2 -17 Copyright 2013, 2010, 2007, Pearson, Education,

Example 6: Crime Stoppers Problem 14. 2 -17 Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Example 6: Crime Stoppers Problem a) Can the residents of Country Oaks start at

Example 6: Crime Stoppers Problem a) Can the residents of Country Oaks start at one intersection (or vertex) and walk each street block (or edge) in the neighborhood exactly once and return to the intersection where they started? b) If yes, determine a circuit that could be followed to accomplish their walk. 14. 2 -18 Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Example 6: Crime Stoppers Problem Solution a) Does a Euler circuit exist? There are

Example 6: Crime Stoppers Problem Solution a) Does a Euler circuit exist? There are no odd vertices. By item 1 of Euler’s theorem, there is at least one Euler circuit. 14. 2 -19 Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Example 6: Crime Stoppers Problem Solution Start at A. Choose AB or AE, neither

Example 6: Crime Stoppers Problem Solution Start at A. Choose AB or AE, neither is a bridge. Choose AB. 14. 2 -20 Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Example 6: Crime Stoppers Problem Solution Continue to trace from vertex to vertex around

Example 6: Crime Stoppers Problem Solution Continue to trace from vertex to vertex around the outside of the graph. Notice that no edge chosen is a bridge. 14. 2 -21 Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Example 6: Crime Stoppers Problem Solution At vertex E. EA is a bridge, so

Example 6: Crime Stoppers Problem Solution At vertex E. EA is a bridge, so choose either EB or EI. Choose EB. Now from vertex B we must choose BF. 14. 2 -22 Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Example 6: Crime Stoppers Problem Solution From vertex F, FI is a bridge, so

Example 6: Crime Stoppers Problem Solution From vertex F, FI is a bridge, so we must choose either FC or FI. Choose FC. From vertex C, our only choice is CG. 14. 2 -23 Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Example 6: Crime Stoppers Problem Solution From vertex G, GJ is a bridge, so

Example 6: Crime Stoppers Problem Solution From vertex G, GJ is a bridge, so we must choose GG. Back at vertex G, and from now on, there is only one choice at each vertex. 14. 2 -24 Copyright 2013, 2010, 2007, Pearson, Education, Inc.