Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

De Bruijn Sequences for Fun and Profit

Intro to De Bruijn Sequences / Supplyframe Unconference Dec 13 2016

  • Login to see the comments

  • Be the first to like this

De Bruijn Sequences for Fun and Profit

  1. 1. De Bruijn Sequences for Fun and Profit Aleksandar Bradic CTO, Supplyframe December 13 2016
  2. 2. (motivation)
  3. 3. (4-decimal digit combination lock) k = 10(base); n = 4(length) Number of combinations: 104 = 10, 000 (kn) Total sequence length: 4 ∗ 104 = 40, 000 (nkn)
  4. 4. De Bruijn sequence A cyclic sequence in which every possible length-n string occurs exactly once as a substring. B(k, n) - De Bruijn sequence of order n on a size-k alphabet.
  5. 5. B(2,12)
  6. 6. De Bruijn sequence B(k, n) has length kn - the number of distinct substrings of length n on given alphabet A ⇒ is optimally short. B(k, n) is not unique. There are (k!)kn−1 kn distinct B(k, n) sequences. ⇒ linear speedup! (O(kn) vs O(nkn))
  7. 7. Generation Hamiltonian Path on De Bruijn graph Using Shift Registers
  8. 8. Hamiltonian Path on De Bruijn graph De Bruijn graph on a set of m symbols S := S1, ....Sm, is a directed graph with mn vertices representing all possible length-n sequences of given symbols: V = Sn = (s1, ..., s1, s1), (s1, ...., s1, s2), ....., (sm, ...., sm, sm) and edges representing set of all possible expressions of vertices as another vertex by shifting all its symbols by one place to the left and adding a new symbol at the end of this vertex: E = ((v1, v2, ...., vn), (v2, ...., vn, si )) : i = 1, ..., m
  9. 9. Hamiltonian Path on De Bruijn graph Each vertex in De Bruijn graph has exactly m incoming and m outgoing edges. Each n-dimensional De Bruijn graph is the line digraph of the (n-1)-dimensional De Bruijn graph with the same set of symbols. Each De Bruijn graph is Eulerian and Hamiltonian.
  10. 10. Hamiltonian Path on De Bruijn graph De Bruijn sequences can be constructed by taking a Hamiltonian path of an n-dimensional De Bruijn graph over k symbols (or a Eulerian cycle of a (n − 1)-dimensional De Bruijn graph).
  11. 11. Generation using shift registers Generate one digit at the time, and repeatedly work with the n most recently generated digits, passing from one tuple (x0, ..., xn−1) to another one (x1, ..., xn−1, xn) by shifting an appropriate new digit in at the right.
  12. 12. Generation using shift registers
  13. 13. Generation using shift registers If we want to generate a single order n sequence on the letters (0, 1, . . . k − 1), where k is prime, we can pick an irreducible polynomial xn − bnxn−1 − · · · − b2x − b1 ∈ Zk[x] and an initial string of n numbers s1 . . . sn which isn’t 00 . . . 0. The next term in the sequence is defined by: sn+1 = b1s1 + b2s2 + · · · + bnsn ∈ Zk[x]
  14. 14. Applications Magic! Indexing 1s in a Computer Word Fault Tolerant Systems Writing detection
  15. 15. Indexing 1s in a Computer Word h(x) = (x ∗ deBruijn) >> (n − lgn) We assume that n is an exact power of 2. Multiplication is performed modulo 2n deBruijn is a computer word whose bit pattern contains a length-n de Bruijn sequence beginning with lgn zeros.
  16. 16. Indexing 1s in a Computer Word
  17. 17. Fault Tolerant Systems In the binary De Bruijn graph there will exist 22n−1−n different Hamiltonian cycles De Bruijn graph B(2, n) with a single node failure has a cycle with at least 2n − n − 1 nodes
  18. 18. Writing detection
  19. 19. Thanks!

×