Finished De Bruijn sections
This commit is contained in:
parent
046c6f9ce4
commit
8d520eabc2
@ -41,14 +41,13 @@ Consider the same lock, now set with a three-digit binary code.
|
||||
How about a four-digit code? How many digits do we need? \par
|
||||
|
||||
\begin{instructornote}
|
||||
Don't spend too long on this problem.
|
||||
Don't spend too much time here.
|
||||
Provide a solution at the board once everyone has had a few
|
||||
minutes to think about this.
|
||||
minutes to think about this problem.
|
||||
\end{instructornote}
|
||||
|
||||
\begin{solution}
|
||||
Interestingly enough, we can only save one digit. \par
|
||||
Any optimal sequence has 15 digits, for example \texttt{0000111101100101000}
|
||||
One example is \texttt{0000 1111 0110 0101 000}
|
||||
\end{solution}
|
||||
|
||||
\vfill
|
||||
|
@ -175,12 +175,12 @@ For example, $C_1 = \texttt{0}$, $C_2 = \texttt{011011}$, and $C_3 = \texttt{011
|
||||
\item If $w$ starts with a \texttt{1}, $w$ must appear in $C_k$ by construction.
|
||||
|
||||
\item If $w$ does starts with a \texttt{0} and contains a \texttt{1}, $w$ has the form
|
||||
$\texttt{0}^x\texttt{1}[..\texttt{y}..]$ \par
|
||||
$\texttt{0}^x\texttt{1}\overline{\texttt{y}}$ \par
|
||||
\note{
|
||||
That is, $x$ copies of \texttt{0} followed by a \texttt{1}, followed by \par
|
||||
an arbitrary sequence $\texttt{y}$ with length $(k-x-1)$.
|
||||
an arbitrary sequence $\overline{\texttt{y}}$ with length $(k-x-1)$.
|
||||
} \par
|
||||
Now consider the word $\texttt{1}[..\texttt{y}..]\texttt{0}^x\texttt{1}[..\texttt{y}..]\texttt{0}^{(x-1)}\texttt{1}$. \par
|
||||
Now consider the word $\texttt{1}\overline{\texttt{y}}\texttt{0}^x\texttt{1}\overline{\texttt{y}}\texttt{0}^{(x-1)}\texttt{1}$. \par
|
||||
This is the concatenation of two consecutive binary numbers with $k$ digits, and thus appears in $C_k$.
|
||||
$w$ is a subword of this word, and therefore also appears in $C_k$.
|
||||
\end{itemize}
|
||||
|
@ -66,6 +66,24 @@ Find the single unique Eulerian cycle in the graph below.
|
||||
\end{solution}
|
||||
|
||||
\vfill
|
||||
|
||||
\theorem{}<eulerexists>
|
||||
A directed graph contains an Eulerian cycle iff...
|
||||
\begin{itemize}
|
||||
\item There is a path between every pair of nodes, and
|
||||
\item every node has as many \say{in} edges as it has \say{out} edges.
|
||||
\end{itemize}
|
||||
|
||||
If the a graph contains an Eulerian cycle, it must contain an Eulerian path. \note{(why?)} \par
|
||||
Some graphs contain an Eulerian path, but not a cycle. In this case, both conditions above must
|
||||
still hold, but the following exceptions are allowed:
|
||||
\begin{itemize}
|
||||
\item There may be at most one node where $(\text{number in} - \text{number out}) = 1$
|
||||
\item There may be at most one node where $(\text{number in} - \text{number out}) = -1$
|
||||
\end{itemize}
|
||||
We won't provide a proof of this theorem today. However, you should convince yourself that it is true:
|
||||
if any of these conditions are violated, why do we know that an Eulerian cycle (or path) cannot exist?
|
||||
|
||||
\pagebreak
|
||||
|
||||
|
||||
@ -77,7 +95,7 @@ We'll call the optimal solution to this problem a \textit{De Bruijn\footnotemark
|
||||
\footnotetext{Dutch. Rhymes with \say{De Grown.}}
|
||||
|
||||
|
||||
\problem{}
|
||||
\problem{}<dbbounds>
|
||||
Let $\mathcal{B}_n$ be the length of an order-$n$ De Bruijn word. \par
|
||||
Show that the following bounds always hold:
|
||||
\begin{itemize}
|
||||
@ -96,7 +114,11 @@ Show that the following bounds always hold:
|
||||
|
||||
\remark{}
|
||||
Now, we'd like to show that $\mathcal{B}_n = 2^n + n - 1$... \par
|
||||
That is, that the optimal solution to the subword problem always has $2^n + n - 1$ letters.
|
||||
That is, that the optimal solution to the subword problem always has $2^n + n - 1$ letters. \par
|
||||
We'll do this by construction: for a given $n$, we want to build a word with length $2^n + n - 1$
|
||||
that solves the binary $n$-subword problem.
|
||||
|
||||
|
||||
|
||||
\definition{}
|
||||
Consider a $n$-length word $w$. \par
|
||||
@ -241,16 +263,20 @@ Draw $G_4$.
|
||||
\end{itemize}
|
||||
\end{solution}
|
||||
|
||||
\problem{}<dbpath>
|
||||
Show that $G_4$ always contains an Eulerian path. \par
|
||||
\hint{\ref{eulerexists}}
|
||||
|
||||
\vfill
|
||||
\pagebreak
|
||||
|
||||
|
||||
\theorem{}
|
||||
\theorem{}<dbeuler>
|
||||
We can now easily construct De Bruijn words for a given $n$: \par
|
||||
\begin{itemize}
|
||||
\item Construct $G_n$,
|
||||
\item then an Eulerian cycle in $G_n$.
|
||||
\item Finally, construct a De Bruijn by writing the label of our starting vertex,
|
||||
\item find an Eulerian cycle in $G_n$,
|
||||
\item then, construct a De Bruijn word by writing the label of our starting vertex,
|
||||
then appending the label of every edge we travel.
|
||||
\end{itemize}
|
||||
|
||||
@ -284,4 +310,48 @@ Find De Bruijn words of orders $2$, $3$, and $4$.
|
||||
\end{solution}
|
||||
|
||||
\vfill
|
||||
|
||||
Let's quickly show that the process described in \ref{dbeuler}
|
||||
indeed produces a valid De Bruijn word.
|
||||
|
||||
\problem{}<dblength>
|
||||
How long will a word generated by the above process be?
|
||||
|
||||
\begin{solution}
|
||||
A De Bruijn graph has $2^n$ edges, each of which is traversed exactly once.
|
||||
The starting node consists of $n - 1$ letters.
|
||||
|
||||
\vspace{2mm}
|
||||
|
||||
Thus, the resulting word contains $2^n + n - 1$ symbols.
|
||||
\end{solution}
|
||||
|
||||
\vfill
|
||||
|
||||
\problem{}<dbsubset>
|
||||
Show that a word generated by the process in \ref{dbeuler}
|
||||
contains every possible length-$n$ subword. \par
|
||||
In other words, show that $\mathcal{S}_n(w) = 2^n$ for a generated word $w$.
|
||||
|
||||
\begin{solution}
|
||||
TODO
|
||||
\end{solution}
|
||||
|
||||
\vfill
|
||||
|
||||
\remark{}
|
||||
\begin{itemize}
|
||||
\item We found that \ref{dbeuler} generates a word with length $2^n + n - 1$ in \ref{dblength}, \par
|
||||
\item and we showed that this word always solves the $n$-subword problem in \ref{dbsubset}.
|
||||
|
||||
\item From \ref{dbbounds}, we know that any solution to the binary $n$-subword problem \par
|
||||
must have at least $2^n + n - 1$ letters.
|
||||
|
||||
\item Finally, \ref{dbpath} guarantees that it is possible to generate such a word in any $G_n$.
|
||||
\end{itemize}
|
||||
|
||||
Thus, we have shown that the process in \ref{dbeuler} generates ideal solutions
|
||||
to the $n$-subword problem, and that such solutions always exist.
|
||||
We can now conclude that for any $n$, the binary $n$-subword problem may be solved with a word of length $2^n + n - 1$.
|
||||
|
||||
\pagebreak
|
@ -97,5 +97,8 @@ Construct $\mathcal{L}(G_2)$ and $\mathcal{L}(G_3)$. What do you notice?
|
||||
|
||||
\begin{solution}
|
||||
After fixing edge labels, we find that
|
||||
$\mathcal{L}(G_2) \cong G_3$, and $\mathcal{L}(G_3) \cong G_4$
|
||||
$\mathcal{L}(G_2) \cong G_3$ and $\mathcal{L}(G_3) \cong G_4$
|
||||
\end{solution}
|
||||
|
||||
\vfill
|
||||
\pagebreak
|
Loading…
x
Reference in New Issue
Block a user