This preview shows page 1. Sign up to view the full content.
Unformatted text preview: ENGG1007 Foundations of Computer Science of Computer Science Euler Path/Circuit
Prof. Francis Chin, Dr SM Yiu November 8/10, 2010 (Chapter 9) 1 Königsberg’s Bridge Problem Bridge Problem ENGG1007 FCS Can we cross all bridges once and return to the starting point? (circuit) point? (circuit) What about a “path” which visits all bridges without returning to the starting point? Modeling the problem in terms of graphs: th Is there a circuit containing every edge in this graph? Equivalent problem: Can you draw this graph without lifting problem Can you draw this graph without lifting the pen from paper or repeating any lines (edges)?
2 Euler Paths and Circuits Paths and Circuits ENGG1007 FCS An Euler circuit (or cycle) is a simple circuit containing Euler every edge the graph every edge in the graph. An Euler path is a simple path containing every edge in the Euler graph. Example: How to determine whether a graph has an Euler path/circuit?
3 Some other Graphs Some other Graphs ENGG1007 FCS 4 Existence of Euler Paths/Circuits of Euler Paths/Circuits ENGG1007 FCS Some observations: Connectivity? Degree-1 vertex: Euler circuit? ? Degree-3? Degree-4? Vertices must have even degree for an Euler path, unless it is the start/end vertex start/end vertex. All vertices must have even degree for an Euler circuit. It can be proved that this is sufficient: A connected graph has an Euler circuit iff all vertices have even degrees A connected graph has an Euler path (but not an Euler circuit) iff exactly two vertices have odd degrees
5 ? Proof of Euler Circuit of Euler Circuit ENGG1007 FCS Theorem: A connected graph has an Euler circuit iff all vertices have even degrees. ertices ha degrees Proof: Only if (=>) part (necessary condition):
Each time an Euler circuit passes through a vertex u it “consumes” two edges incident with u (one “in” and one “out”). An Euler circuit covers all edges of G exactly once. If vertex If a vertex u is visited by the circuit x times, deg(u) = 2x. visited by the circuit deg( 2x 6 Sufficient Condition for Euler Circuit Condition for Euler Circuit
If (<=) part: (If G is a connected graph with all vertices of even degree then contains an Euler circuit) even degree, then G contains an Euler circuit) The proof is by construction. pick any arbitrary vertex u, any arbitrary vertex follow any edge from u to another vertex v, again reach at another vertex through another unvisited edge from v (this is possible because the u u v v number of incident edges at number of incident edges at b any vertex is even) The path will continue until it reaches vertex u again. ENGG1007 FCS 7 Proof for the Sufficient Condition for the Sufficient Condition ENGG1007 FCS It is done if the closed path covers the whole graph, otherwise repeat the previous procedure at some vertex th th u’ in the closed path. A longer closed path will be formed by merging these closed paths by inserting the new closed path to the old closed path at vertex u’.
u u’ This process will repeat until all edges are exhausted.
8 Euler Circuit and Path Circuit and Path ENGG1007 FCS A connected graph has an Euler circuit iff all connected graph has an Euler circuit all vertices have even degrees. A connected graph has an Euler path (but not an Euler circuit) iff exactly two vertices have odd degrees. 9 Some other Graphs Some other Graphs ENGG1007 FCS 10 ...
View Full Document
This note was uploaded on 02/10/2011 for the course ENGG 1007 taught by Professor Unknown during the Spring '11 term at HKU.
- Spring '11
- Computer Science