Upload
prateek-tekchandani
View
220
Download
0
Embed Size (px)
Citation preview
8/6/2019 eulers and hamilton theory
1/18
8/6/2019 eulers and hamilton theory
2/18
Euler Paths and Circuits
DefinitionDEF: AnEuler path in a graph G is a simple
path containing every edge in G. AnEuler
circuit(orEuler cycle) is a cycle which is
an Euler path.
NOTE: The definition applies both to
undirected as well as directed graphs of alltypes.
8/6/2019 eulers and hamilton theory
3/18
Hamilton Paths and Circuits
DefinitionDEF: A Hamilton path in a graph G is a pathwhich visits ever vertex in G exactly once. A
Hamilton circuit(orHamilton cycle) is a cycle
which visits every vertex exactly once, exceptforthe firstvertex, which is also visited at the
end of the cycle.
NOTE: Again, the definition applies both toundirected as well as directed graphs of all
types.
8/6/2019 eulers and hamilton theory
4/18
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 ifG 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.
8/6/2019 eulers and hamilton theory
5/18
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 ofG.
Fleury's Algorithm: O(E)?
8/6/2019 eulers and hamilton theory
6/18
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)
Take A to C.
Can't go to B: that edge is a
bridge of the reduced graph,
and there are two other choices.
How can we recognize a bridge efficiently?
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?
A bridge is not a local
property (i.e. if edge EF
existed then AB would not
be a bridge).
8/6/2019 eulers and hamilton theory
7/18
Dodecahedral GraphIs it Hamiltonian? If so, find the Hamiltonian CycleA
B
CD
E NO
F
G
H
P
JK
M
Z
V
W
X
Y
L
8/6/2019 eulers and hamilton theory
8/18
8/6/2019 eulers and hamilton theory
9/18
Graph ColoringConsider a fictional continent.
8/6/2019 eulers and hamilton theory
10/18
Map ColoringSuppose removed all borders but still wantedto see all the countries. 1 color insufficient.
8/6/2019 eulers and hamilton theory
11/18
Map ColoringSo add another color. Try to fill in everycountry with one of the two colors.
8/6/2019 eulers and hamilton theory
12/18
Map ColoringSo add another color. Try to fill in everycountry with one of the two colors.
8/6/2019 eulers and hamilton theory
13/18
Map ColoringSo add another color. Try to fill in everycountry with one of the two colors.
8/6/2019 eulers and hamilton theory
14/18
Map ColoringSo add another color. Try to fill in everycountry with one of the two colors.
8/6/2019 eulers and hamilton theory
15/18
Map ColoringPROBLEM: Two adjacent countries forced tohave same color. Border unseen.
8/6/2019 eulers and hamilton theory
16/18
Map ColoringSo add another color:
8/6/2019 eulers and hamilton theory
17/18
Map ColoringInsufficient. Need 4 colors because of thiscountry.
8/6/2019 eulers and hamilton theory
18/18
Map ColoringWith 4 colors, could do it.