1 / 13

Euler Circuit

Euler Circuit . Chapter 5. Fleury’s Algorithm. Euler’s theorems are very useful to find if a graph has an Euler circuit or an Euler path when the graph is simple. However, for a complicated graph with hundreds of vertices and edges, we need an algorithm. Algorithm: A set of procedural rules

cricket
Télécharger la présentation

Euler Circuit

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Euler Circuit Chapter 5

  2. Fleury’s Algorithm • Euler’s theorems are very useful to find if a graph has an Euler circuit or an Euler path when the graph is simple. • However, for a complicated graph with hundreds of vertices and edges, we need an algorithm. • Algorithm: A set of procedural rules • Examples • The instruction of assembling a new bike, • Recipe for baking an apple pie

  3. Fleury’s Algorithm • Finds an Euler circuit in a connected graph with no odd vertices. • Finds an Euler path in a connected graph with two odd vertices. • The idea behind the algorithm: Don’t burn your bridges behind you. A B Bridge You would only want to cross that bridge if you know that all edges in A have been traveled.

  4. Fleury’s Algorithm • Bridges are the last edges we want to cross to find an Euler circuit. • The graph whose bridges we are supposed to avoid is not necessarily the original graph of the problem. Instead it is that part of the original graph which has yet to be traveled. • Once we travel along an edge, we are done with it. • Each time we traverse an edge, the untraveled part of the graph changes and its bridges are changing. • We start with 2 copies of the graph: copy 1 for making decisions and copy 2 for record keeping.

  5. B B C D C D E F E F Fleury’s Theorem • Every time we traverse another edge, we erase it from copy 1 but mark (red) and level it with the appropriate number on copy 2. • Copy 1 gets smaller and cop2 gets redder. • Copy 1 helps us decide where to go next; copy 2 helps us reconstruct our trip. Copy 2 Copy 1 A Start at F (arbitrarily)

  6. Fleury’s Theorem Copy 1 Copy 2 A A B B C D C D E F E F Step 1: Travel from F to C Could have also travel from F to D

  7. Fleury’s Theorem Copy 1 Copy 2 A A B B 2 C D C D 1 E F E F Step 2: Travel from C to D Could have also travel to A or to E

  8. Fleury’s Theorem Copy 1 Copy 2 A A B B 3 2 D C C D 1 E F E F Step 3: Travel from D to A Could have also travel to B but not to F – DF is a bridge!

  9. Fleury’s Theorem Copy 1 Copy 2 A A B B 3 4 2 C D C D 1 E F E F Step 4: Travel from A to C Could have also travel to E but not to B – AB is a bridge!

  10. Fleury’s Theorem Copy 1 Copy 2 A A B B 3 4 2 C D C D 5 1 E F E F Step 5: Travel from C to E There is no choice!

  11. Fleury’s Theorem Copy 1 Copy 2 A 7 B 3 4 8 6 2 C D 5 9 1 E F Steps 6, 7, 8, and 9: Only one way to go at each step

  12. Fleury’s Algorithm for finding Euler circuit • First make sure that the graph is connected and all the vertices have even degree. • Pick any vertex as the stating point • When you have a choice, always choose to travel along an edge that is not a bridge of the yet-to-be-traveled part of the graph • Label the edges in the order in which you travel them • When you cannot travel any more, stop. You are done.

  13. Fleury’s Algorithm for finding Euler path • First make sure that the graph is connected and have exactly two vertices of odd degree. • Pick any vertex of the two vertices of odd degree as the stating point. • When you have a choice, always choose to travel along an edge that is not a bridge of the yet-to-be-traveled part of the graph • Label the edges in the order in which you travel them • When you cannot travel any more, stop. You are done. • When steps are followed properly, the trip will guaranteed to end at the other vertex of odd degree.

More Related