21
Graph Theory Euler Paths & Euler Circuits

Graph Theory Euler Paths & Euler Circuits. WHAT YOU WILL LEARN Euler paths and Euler circuits Fleury’s Algorithm

Embed Size (px)

Citation preview

Page 1: Graph Theory Euler Paths & Euler Circuits. WHAT YOU WILL LEARN Euler paths and Euler circuits Fleury’s Algorithm

Graph Theory

Euler Paths & Euler Circuits

Page 2: Graph Theory Euler Paths & Euler Circuits. WHAT YOU WILL LEARN Euler paths and Euler circuits Fleury’s Algorithm

WHAT YOU WILL LEARN

• Euler paths and Euler circuits• Fleury’s Algorithm

Page 3: Graph Theory Euler Paths & Euler Circuits. WHAT YOU WILL LEARN Euler paths and Euler circuits Fleury’s Algorithm

Definitions

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

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

The difference between an Euler path and an Euler circuit is that an Euler circuit must start and end at the same vertex.

Page 4: Graph Theory Euler Paths & Euler Circuits. WHAT YOU WILL LEARN Euler paths and Euler circuits Fleury’s Algorithm

Examples

Euler path

D, E, B, C, A, B, D, C, E

Euler circuit

D, E, B, C, A, B, D, C, E, F, D

Page 5: Graph Theory Euler Paths & Euler Circuits. WHAT YOU WILL LEARN Euler paths and Euler circuits Fleury’s Algorithm

Example: Euler Path and Circuits

For the graphs shown, determine if an Euler path, an Euler circuit, neither, or both exist.

A BC

D

A B C

DE

The graph has many Euler circuits, each of which is also an Euler path. This graph has no odd vertices. One example is A, D, B, C, D, B, A.

The graph has an Euler path but it does not have an Euler circuit. One Euler path is E, C, B, E, D, B, A, D. Each path must begin or end at vertex D or E. This graph has two odd vertices.

Page 6: Graph Theory Euler Paths & Euler Circuits. WHAT YOU WILL LEARN Euler paths and Euler circuits Fleury’s Algorithm

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.

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.

Page 7: Graph Theory Euler Paths & Euler Circuits. WHAT YOU WILL LEARN Euler paths and Euler circuits Fleury’s Algorithm

Example: Using Euler’s Theorem

Use Euler’s theorem to determine whether an Euler path or an Euler circuit exists in the figures shown from the previous example.

AB

C

D

Page 8: Graph Theory Euler Paths & Euler Circuits. WHAT YOU WILL LEARN Euler paths and Euler circuits Fleury’s Algorithm

Example: Using Euler’s Theorem (continued) The graph has no odd

vertices (all vertices are even). According to item 1, at least one Euler circuit exists.

An Euler circuit can be determined by starting at any vertex. The Euler circuit will end at the vertex from which it started. Remember that each Euler circuit is also an Euler path.

AB

C

D

Page 9: Graph Theory Euler Paths & Euler Circuits. WHAT YOU WILL LEARN Euler paths and Euler circuits Fleury’s Algorithm

Example: Using Euler’s Theorem (continued)

There are 3 even vertices (A, B, C) and two odd vertices (D, E). Based on item 2, we conclude that since there are exactly two odd vertices, at least one Euler path exists but no Euler circuits exist. Each Euler path must begin at one of the odd vertices and end at the other odd vertex.

A B C

DE

Page 10: Graph Theory Euler Paths & Euler Circuits. WHAT YOU WILL LEARN Euler paths and Euler circuits Fleury’s Algorithm

Example

a) Is it possible to travel among the states and cross each common state border exactly one time?

b) If it is possible, can he start and end in the same state?

Michigan

Ohio

Indiana

Kentucky

West Virginia

Page 11: Graph Theory Euler Paths & Euler Circuits. WHAT YOU WILL LEARN Euler paths and Euler circuits Fleury’s Algorithm

Solution

We are looking for an Euler path, you must use each edge exactly one time.There are two odd vertices.

Therefore, according to item 2, the graph has at least one Euler

path but no Euler circuits. Therefore, yes, it is possible to travel among these states and cross each common border exactly one time. The researcher must start in either IN or KY and end in the other state.

There is not an Euler circuit, so the researcher cannot start and end in the same state.

MI

OH

IN

KY WV

Page 12: Graph Theory Euler Paths & Euler Circuits. WHAT YOU WILL LEARN Euler paths and Euler circuits Fleury’s Algorithm

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.

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.

Page 13: Graph Theory Euler Paths & Euler Circuits. WHAT YOU WILL LEARN Euler paths and Euler circuits Fleury’s Algorithm

Fleury’s Algorithm (continued)

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.”

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.

Page 14: Graph Theory Euler Paths & Euler Circuits. WHAT YOU WILL LEARN Euler paths and Euler circuits Fleury’s Algorithm

Example

Use Fluery’s algorithm to determine an Euler circuit.

There is at least one Euler circuit since there are no odd vertices.

Start at any vertex to determine an Euler circuit.

AB

C

D

E

FG

Page 15: Graph Theory Euler Paths & Euler Circuits. WHAT YOU WILL LEARN Euler paths and Euler circuits Fleury’s Algorithm

Example (continued)

Start at C. Choose either CB or CD.

Continue to trace from vertex to vertex around the outside of the graph.

A

BC

D

E

FG

1

23

4

5

6

7

8

9

10

start here

Page 16: Graph Theory Euler Paths & Euler Circuits. WHAT YOU WILL LEARN Euler paths and Euler circuits Fleury’s Algorithm

In the following graph, determine an Euler circuit.

a. CBAECDA

b. CBAECDAC

c. EABCDA

d. AEABCD

Page 17: Graph Theory Euler Paths & Euler Circuits. WHAT YOU WILL LEARN Euler paths and Euler circuits Fleury’s Algorithm

In the following graph, determine an Euler circuit.

a. CBAECDA

b. CBAECDAC

c. EABCDA

d. AEABCD

Page 18: Graph Theory Euler Paths & Euler Circuits. WHAT YOU WILL LEARN Euler paths and Euler circuits Fleury’s Algorithm

Is it possible for a person to walk through each doorway in the house, whose floor plan is shown below, without using any of the doorways twice? If so, indicate which room the person may start and where he or she will end.

a. Yes; A-G b. Yes; A-C

c. Yes; C- G d. No

Page 19: Graph Theory Euler Paths & Euler Circuits. WHAT YOU WILL LEARN Euler paths and Euler circuits Fleury’s Algorithm

Is it possible for a person to walk through each doorway in the house, whose floor plan is shown below, without using any of the doorways twice? If so, indicate which room the person may start and where he or she will end.

a. Yes; A-G b. Yes; A-C

c. Yes; C- G d. No

Page 20: Graph Theory Euler Paths & Euler Circuits. WHAT YOU WILL LEARN Euler paths and Euler circuits Fleury’s Algorithm

Use Fleury’s algorithm to determine an Euler circuit in the following graph.

a. BCFAEDA

b. DABCFAE

c. EDABCFA

d. AEDABCFA

Page 21: Graph Theory Euler Paths & Euler Circuits. WHAT YOU WILL LEARN Euler paths and Euler circuits Fleury’s Algorithm

Use Fleury’s algorithm to determine an Euler circuit in the following graph.

a. BCFAEDA

b. DABCFAE

c. EDABCFA

d. AEDABCFA