Eulerian and Hamiltonian Graphs
CS 30 : Discrete Mathematics for Computer Science First Semester, AY 2012-2013
https://sites.google.com/a/dcs.upd.edu.ph/nhsh_classes/cs 30
sablay-logo
Nestine Hope S. Hernandez Algorithms and Complexity Laboratory Department of Computer Science University of the Philippines, Diliman nshernandez@dcs.upd.edu.ph updilseal
Day 20
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Graph Theory
sablay-logo
1
Eulerian and Hamiltonian Graphs Euler Circuits Hamiltonian Cycles
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Euler Circuits Hamiltonian Cycles
Eulerian and Hamiltonian Graphs
De nitions (a) A walk in a graph G = (V , E ) is an alternating list of vertices and edges v , e , v , e , v , e , . . . , vn− , en , vn with n ≥ 0 that start at vertex v , ends at vertex vn , and, in which, for each 1 ≤ i ≤ n, ei 7→ {vi − , vi }. The length of a walk is the number of edges it contains (counting multiple occurrences of the same edge), here n. 0
1
1
2
2
3
1
0
1
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Euler Circuits Hamiltonian Cycles
Eulerian and Hamiltonian Graphs
De nitions (a) A walk in a graph G = (V , E ) is an alternating list of vertices and edges v , e , v , e , v , e , . . . , vn− , en , vn with n ≥ 0 that start at vertex v , ends at vertex vn , and, in which, for each 1 ≤ i ≤ n, ei 7→ {vi − , vi }. The length of a walk is the number of edges it contains (counting multiple occurrences of the same edge), here n. (b) A circuit is a walk of positive length that starts and ends at the same vertex. 0
1
1
2
2
3
1
0
1
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Euler Circuits Hamiltonian Cycles
Eulerian and Hamiltonian Graphs
De nitions (a) A walk in a graph G = (V , E ) is an alternating list of vertices and edges v , e , v , e , v , e , . . . , vn− , en , vn with n ≥ 0 that start at vertex v , ends at vertex vn , and, in which, for each 1 ≤ i ≤ n, ei 7→ {vi − , vi }. The length of a walk is the number of edges it contains (counting multiple occurrences of the same edge), here n. (b) A circuit is a walk of positive length that starts and ends at the same vertex. (c) A trail is a walk with no repeated edges. In a graph with multiple edges, distinct multiple edges may be included. 0
1
1
2
2
3
1
0
1
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Euler Circuits Hamiltonian Cycles
Eulerian and Hamiltonian Graphs
De nitions (a) A walk in a graph G = (V , E ) is an alternating list of vertices and edges v , e , v , e , v , e , . . . , vn− , en , vn with n ≥ 0 that start at vertex v , ends at vertex vn , and, in which, for each 1 ≤ i ≤ n, ei 7→ {vi − , vi }. The length of a walk is the number of edges it contains (counting multiple occurrences of the same edge), here n. (b) A circuit is a walk of positive length that starts and ends at the same vertex. (c) A trail is a walk with no repeated edges. In a graph with multiple edges, distinct multiple edges may be included. (d) A path is a walk with no repeated vertices. 0
1
1
2
2
3
1
0
1
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Euler Circuits Hamiltonian Cycles
Eulerian and Hamiltonian Graphs
De nitions (a) A walk in a graph G = (V , E ) is an alternating list of vertices and edges v , e , v , e , v , e , . . . , vn− , en , vn with n ≥ 0 that start at vertex v , ends at vertex vn , and, in which, for each 1 ≤ i ≤ n, ei 7→ {vi − , vi }. The length of a walk is the number of edges it contains (counting multiple occurrences of the same edge), here n. (b) A circuit is a walk of positive length that starts and ends at the same vertex. (c) A trail is a walk with no repeated edges. In a graph with multiple edges, distinct multiple edges may be included. (d) A path is a walk with no repeated vertices. (e) A cycle is a circuit in which the only vertex repetition is vn = v . 0
1
1
2
2
3
1
0
1
sablay-logo
updilseal
0
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Euler Circuits Hamiltonian Cycles
Eulerian and Hamiltonian Graphs
De nitions (a) A walk in a graph G = (V , E ) is an alternating list of vertices and edges v , e , v , e , v , e , . . . , vn− , en , vn with n ≥ 0 that start at vertex v , ends at vertex vn , and, in which, for each 1 ≤ i ≤ n, ei 7→ {vi − , vi }. The length of a walk is the number of edges it contains (counting multiple occurrences of the same edge), here n. (b) A circuit is a walk of positive length that starts and ends at the same vertex. (c) A trail is a walk with no repeated edges. In a graph with multiple edges, distinct multiple edges may be included. (d) A path is a walk with no repeated vertices. (e) A cycle is a circuit in which the only vertex repetition is vn = v . (f) The distance between two vertices u and v in G , denoted distG (u , v ), is the length of the shortest walk in G between u and v . If there is no walk, then we assign distG (u , v ) = ∞. 0
1
1
2
2
3
1
0
1
sablay-logo
updilseal
0
Discrete Mathematics for Computer Science
CS 30
dcs-logo
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
onships amongCircuits the various Walks,Trails,Paths, and Cycles kinds of walks in Definit he Venn diagram in Figure 8.11. Walks Circuits
sablay-logo
Trails Paths
Cycles
updilseal
Figure 8.11 Kinds of Walks Discrete Mathematics for Computer Science
CS 30
dcs-logo
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
The Konigsberg Bridge Problem In 1736, Konigsberg was a city on the Pregel River in Prussia and was renowned for its beautiful bridges. (Konigsberg is now, Kaliningrad, Russia)
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
The Konigsberg Bridge Problem In 1736, Konigsberg was a city on the Pregel River in Prussia and was renowned for its beautiful bridges. (Konigsberg is now, Kaliningrad, Russia)
A
3 2
1
B 5
sablay-logo
C
4 6
7
D updilseal
·· nigsberg Figure 8.1 The Seven Bridges of Ko dcs-logo
Swiss mathematician Leonard Euler (1707–1782) provided a ·· nigsberg Bridge Problem and others like it, by analyz to the Ko Discrete Mathematics for Computer Science
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
The Konigsberg Bridge Problem In 1736, Konigsberg was a city on the Pregel River in Prussia and was renowned for its beautiful bridges. (Konigsberg is now, Kaliningrad, Russia)
A
3 2
1
B 5
sablay-logo
C
4 6
7
D updilseal
·· nigsberg Figure The Seven Is it8.1 possible, starting fromBridges some placeof in Ko Konisberg, to go for a walk that
passes over each bridge exactly once and returns to the starting place?
dcs-logo
Swiss mathematician Leonard Euler (1707–1782) provided a ·· nigsberg Bridge Problem and others like it, by analyz to the Ko Discrete Mathematics for Computer Science
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
The Konigsberg Bridge Problem
The Swiss mathermatician Leonard Euler provided a clever solution to the Konigsberg Bridge Problem.
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Euler Circuits Hamiltonian Cycles
·· nigsberg could be appropriately traced in F walk through Ko The Konigsberg Bridge Problem one does not exist. An exhaustive argument using Figure such walk exists is outlined in the exercises. A much more el in The Section 9.2, after Euler’s is apresented. Swiss mathermatician LeonardTheorem Euler provided clever solution to Eulerian and Hamiltonian Graphs
the Konigsberg Bridge Problem.
A
sablay-logo
1
3 2
B A B 5
C
4 6
7
5
7
updilseal
D
D
Figure 8.1 The Seven Bridges of
C
6
3 2
1
4
·· nigsberg Ko
·· nigsberg Bridge Graph Figure 8.2 Ko , the Swiss mathematician Leonard Euler (1707–1782) provided a
dcs-logo
·· nigsberg Bridge Problem and others like it, by analyztion to the Ko ms of the diagram in Figure 8.2. There, each land mass is represented Discrete Mathematics for Computer Science
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
Let G be a graph or a digraph. An Euler circuit (respectively, Euler trail) in G is a circuit (respectively, trail) that covers every edge exactly once and covers every vertex. If G contains an Euler circuit, then G is said to be Eulerian.
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
here on graphs and consider digraphs in the exercises. Let G be a graph or a digraph. An Euler circuit (respectively, Euler trail)
ph, in G is a circuit (respectively, trail) that covers every edge exactly once
Start and Finish
and covers every vertex. If G contains an Euler circuit, then G is said to be Eulerian.
3
2
1 10
7
6
5
sablay-logo
4
8 9 updilseal
er circuit have been numbered consecutively. ph, Discrete Mathematics for Computer Science
CS 30
dcs-logo
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
here on graphs and consider digraphs in the exercises. Let G be a graph or a digraph. An Euler circuit (respectively, Euler trail)
ph, in G is a circuit (respectively, trail) that covers every edge exactly once
Start and Finish
and covers every vertex. If G contains an Euler circuit, then G is said to be Eulerian.
3
2
1 10
7
6
5
sablay-logo
4
8 9 updilseal
This is Eulerian!
er circuit have been numbered consecutively. ph, Discrete Mathematics for Computer Science
CS 30
dcs-logo
acl-logo
9
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
f an Euler circuit have been numbered consecutively. red graph, 12
1
2
sablay-logo
11
Start
3 4
Finish
10 9
8 5
7 6
Here we have an Euler trail that is not an Euler circuit.
f an Euler trail that is not an Euler circuit have been consecutively.
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
Euler's Theorem
Given any undirected graph G, (a) G has an Euler circuit if and only if G is connected and every vertex of G has even degree. (b) G has an Euler trail that is not an Euler circuit if and only if G is connected and has exactly two vertices with odd degree.
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
heorem, we consider an How to nd andegree. Euler Circuit... even Euler Circuits Hamiltonian Cycles
Eulerian and Hamiltonian Graphs
Euler’s Theorem).
l
m g
h
v0 n
f e
a
k j d
sablay-logo
b c
i
s connected and every v an Euler circuit for G . I updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
How to nd an Euler Trail...
7
6
5
d) 1
3
4
sablay-logo
2
6
5
f)
updilseal
dcs-logo
1
2 Discrete Mathematics for Computer Science
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
Given any directed graph G on n vertices, (a) G has an Euler circuit if and only if G is strongly connected and every vertex v of G has deg − (v ) = deg + (v ). (b) G has an Euler trail that is not an Euler circuit if and only if every vertex v of G has deg − (v ) = deg + (v ) except that one vertex v has deg + (v ) = 1 + deg − (v ) and another vertex vn has deg − (vn ) = 1 + deg + (vn ) and the directed graph obtained from G by adding the edge (vn , v ) is strongly connected. 1
1
1
sablay-logo
1
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
(l)
v1
b
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
Given any directed graph G on n vertices, (a) G has an Euler circuit if and only if G is strongly connected c devery vertex v of G has deg −v(3v ) = deg + (v ). and (b) G has an Euler trail that is not an Euler circuit if and only if every vertex v of G has deg − (v ) = deg + (v ) except that one vertex v ehas deg + (v ) = 1 + deg − (v ) and another vertex vn has deg − (vn ) = 1 + deg + (vn ) and the directed v2 graph obtained from G by adding the edge (vn , v ) is strongly connected. 1
1
1
sablay-logo
1
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
me shown in Exercise 12. A t dge more than once and retur Euler Circuits Hamiltonian Cycles
Eulerian and Hamiltonian Graphs
Given any directed graph G on n vertices, G has an Euler is circuit out if and only ifof G is strongly connected ng the (a) Tiber service. and every vertex v of G has deg − (v ) = deg + (v ). rossings that can be accompl (b) G has an Euler trail that is not an Euler circuit if and only if every v of G has deg −service, (v ) = deg + (v ) except that he island isvertex out of the + one vertex v has deg (v ) = 1 + deg − (v ) and another ble bridge crossings? vertex vn has deg − (vn ) = 1 + deg + (vn ) and the directed graph obtained from G by adding the edge (vn , v ) is g directed graphs. strongly connected. a j) v1 b
l)
1
1
1
sablay-logo
1
c
v3
d
updilseal
e dcs-logo
v2 Discrete Mathematics for Computer Science
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
De nition Let G be a graph or a digraph. A Hamiltonian cycle (respectively, Hamiltonian path) in G is a cycle (respectively, path) that covers every vertex. By de nition, each vertex must be covered exactly once, with the exception that the starting and ending vertex of a Hamiltonian cycle is covered twice. If G contains a Hamiltonian cycle, then G is said to be Hamiltonian.
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
De nition Let G be a graph or a digraph. A Hamiltonian cycle (respectively, Hamiltonian path) in G is a cycle (respectively, path) that covers every vertex. By de nition, each vertex must be covered exactly once, with the exception that the starting and ending vertex of a Hamiltonian cycle is covered twice. If G contains a Hamiltonian cycle, then G is said to be Hamiltonian.
ed graph have been numbered conse 1
3
sablay-logo
4
2 updilseal
7
6 Discrete Mathematics for Computer Science
5 CS 30
dcs-logo
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
Let G be any graph. If G is Hamiltonian, then κ(G ) ≼ 2.
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
how that a graph does not have a Hamiltonian cy
G represents a computer network.
Let G be any graph. If G is Hamiltonian, then κ(G ) ≼ 2.
sablay-logo
amiltonian cycle in such a network might be of ad ploying a parallel algorithm. In that case, the Ham a route along which each computer could pass a p e an assembly line. However, this graph G is not updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
how that a graph does not have a Hamiltonian cy
G represents a computer network.
Let G be any graph. If G is Hamiltonian, then κ(G ) ≼ 2.
sablay-logo
Not Hamiltonian!
amiltonian cycle in such a network might be of ad ploying a parallel algorithm. In that case, the Ham a route along which each computer could pass a p e an assembly line. However, this graph G is not updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
If C is a Hamiltonian cycle in a graph G = (V , E ), then (a) C covers exactly two edges incident with each vertex, and (b) C has no subgraph which is a cycle on fewer than |V | vertices. In the case that G is directed, for each vertex v , C must cover exactly one edge whose head is v and one whose tail is v .
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
re is no Hamiltonian cycle in the
If C is a Hamiltonian cycle in a graph G = (V , E ), then (a) C covers exactly two edges incident with each vertex, and (b) (d). C has no subgraph which is a cycle on fewer than |V | 10. Graph vertices. then .case that G is directed, for each vertex v , C must cover exactly 12.In P one edge whose head is v and one whose tail is v .
14.
sablay-logo
1
6
7
2 updilseal
5
4
3
the subsequent exercises. Discrete Mathematics for Computer Science
dcs-logo
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
re is no Hamiltonian cycle in the
If C is a Hamiltonian cycle in a graph G = (V , E ), then (a) C covers exactly two edges incident with each vertex, and (b) (d). C has no subgraph which is a cycle on fewer than |V | 10. Graph vertices. then .case that G is directed, for each vertex v , C must cover exactly 12.In P one edge whose head is v and one whose tail is v .
14.
sablay-logo
1
6
7
2 updilseal
5
4
3
Not Hamiltonian!
the subsequent exercises. Discrete Mathematics for Computer Science
CS 30
dcs-logo
acl-logo
Hamiltonian.
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
Hamiltonian. If C is a Hamiltonian cycle in a graph G = (V , E ), then
(a) Hamiltonian.
C covers exactly two edges incident with each vertex, and (b) C has no subgraph which is a cycle on fewer than |V | vertices.path in the nd a Hamiltonian In the case that Ggraph. is directed, for each vertex v , C must cover exactly ctured directed one edge whose head is v and one whose tail is v .
2
sablay-logo
4
updilseal
1
3
dcs-logo
nd a Hamiltonian path in the Discrete Mathematics for Computer Science
CS 30
acl-logo
Hamiltonian.
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
Hamiltonian. If C is a Hamiltonian cycle in a graph G = (V , E ), then
(a) Hamiltonian.
C covers exactly two edges incident with each vertex, and (b) C has no subgraph which is a cycle on fewer than |V | vertices.path in the nd a Hamiltonian In the case that Ggraph. is directed, for each vertex v , C must cover exactly ctured directed one edge whose head is v and one whose tail is v .
2
sablay-logo
4
updilseal
1
3
Not Hamiltonian!
dcs-logo
nd a Hamiltonian path in the Discrete Mathematics for Computer Science
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
For any simple undirected graph G = (V , E ) with |V | ≥ 3, if δ(G ) ≥ |V | , then G is Hamiltonian (where
δ(G )
2
is the minimum degree of a graph G).
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
m 9.11 that the pictured graph G = (V, E) is For any simple undirected graph G = (V , E ) with |V | ≥ 3, . |V | ) = 4 =if δ(|V| G 2 ) ≥ , then G is Hamiltonian (where
δ(G )
2
is the minimum degree of a graph G).
A
B
sablay-logo
H
C
G
D updilseal
F
E
dcs-logo
d in this case to find a Hamiltonian cycle, such as Discrete Mathematics for Computer Science
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
A tournament is a directed graph whose underlying graph is complete.
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
A tournament is a directed graph whose underlying graph is complete. Every tournament has a Hamiltonian path.
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
ustAhave a Hamiltonian path by The tournament is a directed graph whose underlying graph is complete. Every tournament has a Hamiltonian path.
5
sablay-logo
1
4
updilseal
2
3
Discrete Mathematics for Computer Science
dcs-logo
CS 30
acl-logo
16. Q3 .
Eulerian and Hamiltonian Graphs
15. K 2,3 .
18. P6 .
17. K 5 .
Euler Circuits Hamiltonian Cycles
16. Q3 .
6 8 4 18. P6 . 57 3 20. 1 2 3 1 21. 21 32 3be maximally efficient, FedEx does not want its truck to pass by a 3 ivery sight to which a delivery has already been it wants the 5 6made, and 4 8 5 5 4 same location 6 7 5 4 ck to exit the neighborhood at 5 from the 6 4 which4 the truck 6 ered. Does such a maximally efficient delivery route exist? Justify your wer. 32. The pictured graph is a tournament. 7 8 7 graph8 is Hamiltonian. 9 7 6 the7pictured 8 directed 9 ermine(a) whether 98 (b) (c) 87
20.
2 19.
2
3 21.
5
1
2
1
3
5
64
9
7
8
2
Xia
3
6
4
8
2
1
5
sablay-logo
22. It isJack easy to find a Hamilto remaining edges form an E an Euler circuit? Justify yo 23. Since several potholes dev pictured neighborhood nee updilseal
9
Zed Quo 6cycle (d)to find (e)some 22.a It is easy a Hamiltonian cycle Cn values in K n . For sy to find Hamiltonian C7n in K n8. For of n,some the values of n, the c dcs-logo c remaining edges formFor an Euler Fornwhich ning edges form an Euler circuit. whichcircuit. integers does Cintegers n have n does C n have an Euler circuit? Justify your answer. circuit? graph Justifyis answer. eerpictured areflects tournament. Ityour the results of a round robin Scrabble tournament. 23. Sincedeveloped several potholes developed over thethe winter months, the everal potholes over the winter months, streets in thethe streets in acl-logo
(a) Who won the match between Jack and Zed?
Discrete Mathematics for Computer Science
CS 30
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
An application of Hamiltonian cycles to coding The position of a rotating pointer can be represented in digital form. One way to do this is to split the circle into 2n arcs of equal length and to assign a bit string of length n to each arc.
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
An application of Hamiltonian cycles to coding The position of a rotating pointer can be represented in digital form. One way to do this is to split the circle into 2n arcs of equal length and to assign a bit string of length n to each arc.
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
An application of Hamiltonian cycles to coding The position of a rotating pointer can be represented in digital form. One way to do this is to split the circle into 2n arcs of equal length and to assign a bit string of length n to each arc.
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
An application of Hamiltonian cycles to coding
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
An application of Hamiltonian cycles to coding
When the pointer is near the boundary of two arcs, a mistake may be made in reading its position. This may result in a major error in the bit string read.
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
An application of Hamiltonian cycles to coding
When the pointer is near the boundary of two arcs, a mistake may be made in reading its position. This may result in a major error in the bit string read. If a small error is made in determining the position of the pointer, the bit string 100 is read instead of 011. All three bits are incorrect!
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
An application of Hamiltonian cycles to coding
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
An application of Hamiltonian cycles to coding
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
An application of Hamiltonian cycles to coding A Gray code is a labeling of the arcs of the circle such that adjacent arcs are labeled with bit strings that di er in exactly one bit.
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
An application of Hamiltonian cycles to coding A Gray code is a labeling of the arcs of the circle such that adjacent arcs are labeled with bit strings that di er in exactly one bit. We can model the problem of nding a gray code using the n-cube Qn .
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
An application of Hamiltonian cycles to coding A Gray code is a labeling of the arcs of the circle such that adjacent arcs are labeled with bit strings that di er in exactly one bit. We can model the problem of nding a gray code using the n-cube Qn .
sablay-logo
updilseal
What we need is a Hamiltonian cycles in Qn . Discrete Mathematics for Computer Science
dcs-logo
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Euler Circuits Hamiltonian Cycles
An application of Hamiltonian cycles to coding A Gray code is a labeling of the arcs of the circle such that adjacent arcs are labeled with bit strings that di er in exactly one bit. We can model the problem of nding a gray code using the n-cube Qn .
sablay-logo
Gray codes are named after Frank Gray, who invented them in the 1940s at AT&T Bell Laboratories to minimize the e ect of errors in transmitting digital signals.
What we need is a Hamiltonian cycles in Qn . Discrete Mathematics for Computer Science
updilseal
dcs-logo
CS 30
acl-logo
Eulerian and Hamiltonian Graphs
Questions?
sablay-logo
See you next meeting!
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo