Graph Theory37 sections · 1633 units
Open in Course

De Bruijn Sequences

Visiting all n-bit strings.

A De Bruijn sequence of order nn over alphabet {0,1}\{0, 1\} is the shortest cyclic sequence containing every nn-bit string as a substring exactly once.

Example: For n=2n = 2, the strings are 00,01,10,1100, 01, 10, 11. The De Bruijn sequence is 00110011 (cyclic: 00,01,11,1000, 01, 11, 10).

Connection to Euler circuits: Build a graph where:

  • Vertices are (n1)(n-1)-bit strings
  • Edge from ab.cab.c to b.cdb.cd represents the nn-bit string ab.cdab.cd

Finding an Euler circuit on this graph gives the De Bruijn sequence.