You are on page 1of 18

Euler Paths and Circuits Definition

DEF: An Euler path in a graph G is a simple path containing every edge in G. An Euler circuit (or Euler cycle) is a cycle which is an Euler path. NOTE: The definition applies both to undirected as well as directed graphs of all types.

Hamilton Paths and Circuits Definition DEF: A Hamilton path in a graph G is a path
which visits ever vertex in G exactly once. A Hamilton circuit (or Hamilton cycle) is a cycle which visits every vertex exactly once, except for the first vertex, which is also visited at the end of the cycle. NOTE: Again, the definition applies both to undirected as well as directed graphs of all types.

An Euler Circuit is a cycle of an undirected graph, that traverses every edge of the graph exactly once, and ends at the same node from which it began. Euler's Theorem: A connected graph G possesses an Euler circuit if and only if G does not contain any nodes of odd degree.

Proof of Euler's theorem: Assume that G has zero nodes of odd degree. It can then be shown that this is a necessary and a sufficient condition for an Euler circuit to exist. Part 1: It is necessary because any Euler circuit drawn on the graph must always enter a node through some edge and leave through another and all edges on the graph must be used exactly once. Thus, an even number of incident edges is required for every node on the graph.

Fleury's Algorithm: O(E)?


1. Pick any vertex to start. 2. From that vertex pick an edge to traverse, considering following rule: never cross a bridge of the reduced graph unless there is no other choice. 3. Darken that edge, as a reminder that you can't traverse it again. 4. Travel that edge, coming to the next vertex. 5. Repeat 2-4 until all edges have been traversed, and you are back at the starting vertex. By reduced graph we mean the original graph minus the darkened (already used) edges. A bridge of a graph G is an edge whose deletion increases the number of components of G.

Fleury's Algorithm in Action

Pick any vertex (e.g. F) Take F to C (arbitrary)

Take C to D (arbitrary)

Take D to A (arbitrary)

A bridge is not a local property (i.e. if edge EF existed then AB would not be a bridge). How can we recognize a bridge efficiently?
Take A to C. Can't go to B: that edge is a bridge of the reduced graph, and there are two other choices.

In the original graph, AB was not a bridge. Can we preprocess the graph in O(E) time identifying bridges and building a structure that can be updated in constant time with each reduction?

Dodecahedral Graph
Is it Hamiltonian? If so, find the Hamiltonian Cycle A
F O E N Z W M Y X K L D J C P V G H B

Graph Coloring
Consider a fictional continent.

Map Coloring
Suppose removed all borders but still wanted to see all the countries. 1 color insufficient.

Map Coloring
So add another color. Try to fill in every country with one of the two colors.

Map Coloring
So add another color. Try to fill in every country with one of the two colors.

Map Coloring
So add another color. Try to fill in every country with one of the two colors.

Map Coloring
So add another color. Try to fill in every country with one of the two colors.

Map Coloring
PROBLEM: Two adjacent countries forced to have same color. Border unseen.

Map Coloring
So add another color:

Map Coloring
Insufficient. Need 4 colors because of this country.

Map Coloring
With 4 colors, could do it.

You might also like