Professional Documents
Culture Documents
DE BRUIJN GRAPHS
AND SEQUENCES
1
EULERIAN GRAPHS
Definitions
11
10
2
3
7
6
8
4
5
11
12
which must be
Therefore,
must be an even number.
Therefore, the numbers
must include an even number
of odd numbers.
Every graph has an even number of odd vertices.
13
14
Proof:
If G has an Euler trail , thenas in the proof of Theorem1 ,
each vertex has an even degree.
Assume then that G is connected and has at most two
vertices of odd degree. If G has no vertices of odd degree then,
by Theorem 1, G has an Euler trail.
15
16
4
1
17
7
8
18
FLEURYS
ALGORITHM
19
Algorithms
When the graph has an Euler circuit or path, how do we find it?
For small graphs, simple trial-and-error usually works fine, but
real-life applications sometimes involve graphs with hundreds, or
even thousands, of vertices. In these cases a trial-and-error
approach is out of the question, and what is needed is a
systematic strategy that tells us how to create an Euler circuit or
path. In other words, we need an algorithm.
20
Algorithms
There are many types of problems that can be solved by simply
following a set of procedural rulesvery specific rules like when
you get to this point, do this, ... after you finish this, do that, and
so on. Given a specific problem X, an algorithm for solving X is
a set of procedural rules that, when followed, always lead to
some sort of solution to X. X need not be a mathematics
problemalgorithms are used, sometimes unwittingly, in all
walks of life:
21
Algorithms
directions to find someones house, the instructions for
assembling a new bike, or a recipe for baking an apple pie are all
examples of real-life algorithms. A useful analogy is to think of
the problem as a dish we want to prepare and the algorithm as a
recipe for preparing that dish. In mathematics, algorithms are
either formula driven (you just apply the formula or formulas to
the appropriate inputs) or directive driven (you must follow a
specific set of directives).
22
Fleurys Algorithm
We will now turn our attention to an algorithm that finds an
Euler circuit or an Euler path in a connected graph. Technically
speaking, these are two separate algorithms, but in essence they
are identical, so they can be described as one.
The idea behind Fleurys algorithm can be paraphrased by that
old piece of folk wisdom: Dont burn your bridges behind you.
23
Fleurys Algorithm
In graph theory the word bridge has a very specific meaningit is
the only edge connecting two separate sections (call them
A and B) of a
graph, as
illustrated in
Fig.
5-18.
24
Fleurys Algorithm
Thus, Fleurys algorithm is based on a simple principle: To find
an Euler circuit or an Euler path, bridges are the last edges you
want to cross. Our concerns lie only on how we are going to get
around the yet-to-be-traveled part of the graph. Thus, when we
talk about bridges that we want to leave as a last resort,we are
really referring to bridges of the to-be-traveled part of the graph.
25
26
27
28
29
Example 5.20
Example 5.20
Start: We can pick any starting point we want. Lets say we start at
F.
31
Example 5.20
32
Example 5.20
33
Example 5.20
34
Example 5.20
35
Example 5.20
36
Example 5.20
37
Example 5.21
38
Example 5.21
Start. This graph has two odd vertices, E and J. We can pick
either one as the starting vertex. Lets start at J.
39
Example 5.21
Step 1. From J we have five choices, all of which are OK. Well
randomly pick K. (Erase JK on copy 1, and mark and label JK
with a 1 on copy 2.)
Example 5.21
Example 5.21
42
Example 5.21
43
Example 5.21
44
Example 5.21
Step 9 through 13. Each time we have only one choice. From
B we have to go to A, then to J, I, H, and G.
45
Example 5.21
Step 14 through 21. Not to belabor the point, lets just cut to
the chase. The rest of the path is given by G, F, E, D, C, E, G, L,
E. There are many possible endings, and you should find a
different one by yourself.
46
Example 5.21
47
DE BRUIJN
GRAPHS AND
SEQUENCES
48
De Bruijn Graphs
A graph is a an ordered pair G = (V;E) where V is a set of vertices
called nodes, together with a set E of edges which are pairs of
nodes.
Directed graphs, graphs whose edges are an ordered pair of nodes.
A subgraph, G = (V ;E), of a graph G = (V;E), is a graph on a
subset V of V with the property that every edge e E with
endpoints in V is also in E.
49
50
Successor
Predecessor
Node
52
Constructed Graph:
3.
2.
1.
AA
AA, AA
5.
AA, AA AA, AB
4.
AA AA, AA AB, AB BB
6.
Note: When graphing the De Bruijn, there is an edge connecting between the left and the right
nodes.
55
DE BRUIJN
SEQUENCES
56
57
De Bruijn cycles
1.4.25
Application:
There are 2n binary strings of length n.
Is there a cyclic arrangement of 2 n binary digits such that the 2 n
strings of n consecutive digitals are all distinct?
Example: For n =4, (0000111101100101) works.
0
0
0
1
0
1
Graph Theory
0
Ch. 1. Fundamental Concept
1
58
De Bruijn cycles
1.4.25
Graph Theory
59
De Bruijn cycles
1.4.25
Graph Theory
60
De Bruijn cycles
1.4.25
0
1
Graph Theory
011
001
000
0
1
1
100
101
010
0
1
0
111
0
110
61
De Bruijn cycles
1.4.25
We next prove that Dn is Eulerian and show how an Eulerian circuit yields the desired
circular arrangement.
Graph Theory
62
Theorem. The digraph Dn of Application 1.4.25 is Eulerian, and the edge labels on
the edges in any Eulerian circuit of Dn form a cyclic arrangement in which the
2n consecutive segments of length n are distinct. 1.4.26
Proof:
We show
first that Dn is Eulerian.
Then the labels on the edges in any Eulerian circuit
of Dn form a cyclic arrangement in which the 2n
consecutive segments of length n are distinct.
Graph Theory
63
001
101
Graph Theory
111
110
64
Proof: 2/2
Also, Dn is strongly connected,
because we can reach the vertex b=(b1,..,bn-1) from any
vertex by successively follows the edges labeled b1,
..,bn-1.
001
1
0
000
0
Graph Theory
0
1 1
011
1
1
100
Ch. 1. Fundamental Concept
0
0
1
101
010
111
0
110
65
Theorem. The labels on the edges in any Eulerian circuit of Dn form a cyclic
arrangement in which the 2n consecutive segments of length n are distinct.
1.4.26
Proof: 1/4
Let C be an Eulerian circuit of Dn. Arrival at vertex
a=(a1,..,an-1) must be along an edge with label an-1
because the label on an edge entering a vertex agrees
with the last entry of the name of the vertex.
a
001
1
0
000
0
Graph Theory
0
1
011
1
1
100
Ch. 1. Fundamental Concept
0
0
1
101
010
111
0
110
66
Theorem. The labels on the edges in any Eulerian circuit of Dn form a cyclic
arrangement in which the 2n consecutive segments of length n are distinct.
1.4.26
Proof: 2/4
The successive earlier labels
have been an-2,..,a1 in order.
(looking backward)
must
001
1
0
000
0
Graph Theory
0
1
011
1
1
100
Ch. 1. Fundamental Concept
0
0
1
101
010
111
0
110
67
Theorem. The labels on the edges in any Eulerian circuit of Dn form a cyclic
arrangement in which the 2n consecutive segments of length n are distinct.
1.4.26
Proof: 2/4
If C next uses an edge with label an, then the list
consisting of the n most recent edge labels at that time
is a1,..an.
a
001
1
0
000
0
1 1
100
Graph Theory
1
0
0
b
1
1
101
010
0
011
111
0
110
68
Theorem. The labels on the edges in any Eulerian circuit of Dn form a cyclic
arrangement in which the 2n consecutive segments of length n are
distinct. 1.4.26
Proof: 3/4
Since
the 2n-1 vertex labels are distinct, and
the two out-going edges have distinct labels, and
we traverse each edge exactly once
Distinct vertex
label
011 0
011 1
Graph Theory
Distinct labels on
out-going edges
69
Theorem. The labels on the edges in any Eulerian circuit of Dn form a cyclic
arrangement in which the 2n consecutive segments of length n are
distinct. 1.4.26
Proof: 4/4
We have shown that the 2n strings of length n in the
circular arrangement given by the edge labels along C
are distinct.
Graph Theory
70