230 likes | 602 Views
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 .
E N D
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.
Euler path D, E, B, C, A, B, D, C, E Euler circuit Examples D, E, B, C, A, B, D, C, E, F, D
B A C B C A D D E Example: Euler Path and Circuits • For the graphs shown, determine if an Euler path, an Euler circuit, neither, or both exist. 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. 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.
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.
B A C D 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.
B A C D 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.
B C A D E 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.
Michigan Ohio Indiana West Virginia Kentucky 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?
MI IN OH WV KY 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.
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.
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.
B A C F D G E 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.
Start at C. Choose either CB or CD. Continue to trace from vertex to vertex around the outside of the graph. start here 10 6 9 1 5 7 B 4 A C 8 2 3 F D G E Example (continued)
In the following graph, determine an Euler circuit. a. CBAECDA b. CBAECDAC c. EABCDA d. AEABCD
In the following graph, determine an Euler circuit. a. CBAECDA b. CBAECDAC c. EABCDA d. AEABCD
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
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
Use Fleury’s algorithm to determine an Euler circuit in the following graph. a. BCFAEDA b. DABCFAE c. EDABCFA d. AEDABCFA
Use Fleury’s algorithm to determine an Euler circuit in the following graph. a. BCFAEDA b. DABCFAE c. EDABCFA d. AEDABCFA