copyright 2013, 2010, 2007, pearson, education, inc. section 14.2 euler paths, and euler circuits

24
Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.2 Euler Paths, and Euler Circuits

Upload: naomi-shelton

Post on 06-Jan-2018

221 views

Category:

Documents


0 download

DESCRIPTION

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

TRANSCRIPT

Page 1: Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.2 Euler Paths, and Euler Circuits

Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Section 14.2

Euler Paths, and Euler Circuits

Page 2: Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.2 Euler Paths, and Euler Circuits

Copyright 2013, 2010, 2007, Pearson, Education, Inc.

What You Will Learn

Euler PathsEuler CircuitsEuler’s TheoremFleury’s Algorithm

14.2-2

Page 3: Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.2 Euler Paths, and Euler Circuits

Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Euler Path

An Euler path is a path that passes through each edge of a graph exactly one time.

14.2-3

Page 4: Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.2 Euler Paths, and Euler Circuits

Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Euler Circuit

An Euler circuit is a circuit that passes through each edge of a graph exactly one time.

14.2-4

Page 5: Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.2 Euler Paths, and Euler Circuits

Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Euler Path versus Euler CircuitThe 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

Page 6: Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.2 Euler Paths, and Euler Circuits

Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Euler Path versus Euler CircuitEuler PathD, E, B, C, A, B, D, C, E

Euler CircuitD, E, B, C, A, B, D, C, E, F, D14.2-6

Page 7: Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.2 Euler Paths, and Euler Circuits

Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Euler’s TheoremFor 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

Page 8: Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.2 Euler Paths, and Euler Circuits

Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Euler’s Theorem2. 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

Page 9: Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.2 Euler Paths, and Euler Circuits

Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Example 3: Solving the Königsberg Bridge ProblemCould a walk be taken through Königsbergduring whicheach bridge iscrossed exactlyone time?

14.2-9

Page 10: Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.2 Euler Paths, and Euler Circuits

Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Example 3: Solving the Königsberg Bridge ProblemSolutionHere’s a representation of the problem: vertices are the land, edges are the bridges.

14.2-10

Page 11: Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.2 Euler Paths, and Euler Circuits

Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Example 3: Solving the Königsberg Bridge ProblemSolutionDoes an Euler path exist?Four odd vertices: A, B, C, DSo, according to item 3 ofEuler’s Theorem, no Eulerpath exists.

14.2-11

Page 12: Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.2 Euler Paths, and Euler Circuits

Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Fleury’s AlgorithmTo 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

Page 13: Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.2 Euler Paths, and Euler Circuits

Copyright 2013, 2010, 2007, Pearson, Education, Inc.

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

Page 14: Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.2 Euler Paths, and Euler Circuits

Copyright 2013, 2010, 2007, Pearson, Education, Inc.

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

Page 15: Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.2 Euler Paths, and Euler Circuits

Copyright 2013, 2010, 2007, Pearson, Education, Inc.

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

Page 16: Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.2 Euler Paths, and Euler Circuits

Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Example 6: Crime Stoppers ProblemOn 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

Page 17: Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.2 Euler Paths, and Euler Circuits

Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Example 6: Crime Stoppers Problem

14.2-17

Page 18: Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.2 Euler Paths, and Euler Circuits

Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Example 6: Crime Stoppers Problema) 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

Page 19: Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.2 Euler Paths, and Euler Circuits

Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Example 6: Crime Stoppers ProblemSolutiona) Does a Euler circuit exist?There are no odd vertices.

14.2-19

By item 1 ofEuler’s theorem,there is at leastone Euler circuit.

Page 20: Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.2 Euler Paths, and Euler Circuits

Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Example 6: Crime Stoppers ProblemSolutionStart at A. Choose AB or AE,

neither is a bridge. Choose AB.

14.2-20

Page 21: Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.2 Euler Paths, and Euler Circuits

Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Example 6: Crime Stoppers ProblemSolutionContinue to trace from vertex to

vertex around the outside of the graph. Notice that no edge chosen is a bridge.

14.2-21

Page 22: Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.2 Euler Paths, and Euler Circuits

Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Example 6: Crime Stoppers ProblemSolutionAt 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

Page 23: Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.2 Euler Paths, and Euler Circuits

Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Example 6: Crime Stoppers ProblemSolutionFrom 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

Page 24: Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.2 Euler Paths, and Euler Circuits

Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Example 6: Crime Stoppers ProblemSolutionFrom 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