In combinatorial mathematics, a k-ary De Bruijn sequence B(k, n) of order n, named after the Dutch mathematician Nicolaas de Bruijn, is a cyclic sequence of a given alphabet A with size k for which every possible subsequence of length n in A appears as a sequence of consecutive characters exactly once [1] .
In chess programming there are applications of de Bruijn sequences with the Binary alphabet, in hashing sets like Piece-Sets or Square-sets, also called Bitboards, most notably in Bit scanning[2] .
According to De Bruijn himself [4] , the existence of De Bruijn sequences were first proved, for the case of alphabets with two elements, by Camille Flye Sainte-Marie in 1894, whereas the generalization to larger alphabets is originally due to Tanja van Ardenne-Ehrenfest[5] and himself.
Binary digits or bits inside a computer word are B(2, n) de Bruijn sequences, with 2n bits length and equal number of ones and zeros, with 2n overlapping unique n-bit subsequences. Since the sequences are cyclic and n-1 subsequences need to wrap, we restrict them to at least n-1 leading zeros, to make them overlap the hidden trailing "zeros".
Odd sequences have n leading zeros. The even ones with n-1 leading zeros are rotated (shifted) left by one. Due to n leading zeros of these odd sequences we further consider, the first subsequence[0] is zero. Due to the overlapping, each subsequence[i+1] is dependent from subsequence[i]. The doubled value incremented by either zero or one. Since subsequence[0] is zero, a second zero subsequence with six consecutive binary zeros is further prohibited, and subsequence[1] must be one. Subsequence index i is counted from most significant bit left to right, and therefor reversed from usual bit-index. A modulo 2n restricts all subsequences to n bits:
The Cardinality of all distinct B(2, n) de Bruijn sequences is:
1
0
1
2
0
1
3
1
2
4
4
16
5
11
2,048
6
26
67,108,864
7
57
144,115,188,075,855,872
8
120
~1.329e+36
B(2, 1)
The two one-bit subsequences obviously do not overlap:
i 01 s[i]
0 0 0
1 1 1
B(2, 2)
B(2, 2) implies 2^2 or 4-bit sequences. There is one odd four-bit de Bruijn sequence with four overlapping unique two-bit subsequences, 0x3.
B(2, 3) implies 2^3 or 8-bit sequences. There are two odd eight-bit sequences with eight overlapping unique three-bit subsequences, 0x17 and 0x1d. Note that the five relevant bits are reversed.
B(2, 5) implies 2^5 or 32 bit sequences. There are 2^11 or 2,048 odd 32-bit sequences with 32 overlapping unique five-bit subsequences, for instance 0x076be629
B(2, 6) implies 2^6 or 64 bit sequences. There are 2^26 or 67,108,864 odd 64-bit sequences with 64 overlapping unique six-bit subsequences, for instance 0x022fdd63cc95386d
A De Bruijn graph is a directed graph representing overlaps between sequences of symbols [6] .
Each vertex 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
Each de Bruijn graph is Eulerian and Hamiltonian. The Euler cycles and Hamiltonian cycles of these graphs are de Bruijn sequences.
The graph construction of the three smallest binary de Bruijn graphs
B(2, 4) Graph
A De Bruijn graph. Every four-digit sequence occurs exactly once if one traverses every edge exactly once and returns to one's starting point.
De Bruijn Graph on a Chess Board
A directed De Bruijn Graph of B(2, 6) sequences with Little-Endian Rank-File Mapping board coordinates (a1 = 0, b1 = 1, h8 = 63). For topology reasons, almost each node (except a1 and h8) of the graph is deconcentrated and appears twice in the form of two reversed binary trees. The leaf outputs join the respective reversed tree. Between c6 and f3 is a direct cycle, since 42 is 2*21 and 21 is (2*42 + 1) % 64, with both six-bit pattern reversed - 010101 (21) versus 101010 (42). The challenge is to traverse the graph in any way to visit each of the 64 nodes aka squares exactly once.
So called De Bruijn Networks with the topology of De Bruijn Graphs have interesting properties in processor and computer networks, for instance as described by Feldmann et al. to connect Transputer networks [7][8] .
Camille Flye Sainte-Marie (1894). Solution to question nr. 48, L'Intermédiaire des Mathématiciens 1, reproduced in Nicolaas de Bruijn (1975). Acknowledgement of priority to C. Flye Sainte-Marie on the counting of circular arrangements of 2n zeros and ones that show each n-letter word exactly once. Technical Report, Technische Hogeschool Eindhoven, pdf
1946
Nicolaas de Bruijn (1946). A Combinatorial Problem. Koninklijke Nederlandse Akademie v. Wetenschappen 49: 758–764.
Anwitaman Datta, Sarunas Girdzijauskas, Karl Aberer (2004). On de Bruijn routing in distributed hash tables: There and back again. P2P2004, The 4th IEEE International Conference on Peer-to-Peer Computing, pdf
^Nicolaas de Bruijn (1975). Acknowledgement of priority to C. Flye Sainte-Marie on the counting of circular arrangements of 2n zeros and ones that show each n-letter word exactly once. Technical Report, Technische Hogeschool Eindhoven, pdf
In chess programming there are applications of de Bruijn sequences with the Binary alphabet, in hashing sets like Piece-Sets or Square-sets, also called Bitboards, most notably in Bit scanning [2] .
Table of Contents
Binary alphabet
According to De Bruijn himself [4] , the existence of De Bruijn sequences were first proved, for the case of alphabets with two elements, by Camille Flye Sainte-Marie in 1894, whereas the generalization to larger alphabets is originally due to Tanja van Ardenne-Ehrenfest [5] and himself.Binary digits or bits inside a computer word are B(2, n) de Bruijn sequences, with 2n bits length and equal number of ones and zeros, with 2n overlapping unique n-bit subsequences. Since the sequences are cyclic and n-1 subsequences need to wrap, we restrict them to at least n-1 leading zeros, to make them overlap the hidden trailing "zeros".
Odd sequences have n leading zeros. The even ones with n-1 leading zeros are rotated (shifted) left by one. Due to n leading zeros of these odd sequences we further consider, the first subsequence[0] is zero. Due to the overlapping, each subsequence[i+1] is dependent from subsequence[i]. The doubled value incremented by either zero or one. Since subsequence[0] is zero, a second zero subsequence with six consecutive binary zeros is further prohibited, and subsequence[1] must be one. Subsequence index i is counted from most significant bit left to right, and therefor reversed from usual bit-index. A modulo 2n restricts all subsequences to n bits:
The Cardinality of all distinct B(2, n) de Bruijn sequences is:
B(2, 1)
The two one-bit subsequences obviously do not overlap:B(2, 2)
B(2, 2) implies 2^2 or 4-bit sequences. There is one odd four-bit de Bruijn sequence with four overlapping unique two-bit subsequences, 0x3.B(2, 3)
B(2, 3) implies 2^3 or 8-bit sequences. There are two odd eight-bit sequences with eight overlapping unique three-bit subsequences, 0x17 and 0x1d. Note that the five relevant bits are reversed.B(2, 4)
B(2, 4) implies 2^4 or 16 bit sequences. There are 16 odd 16-bit sequences with 16 overlapping unique four-bit subsequences:for instance 0x0d2f:
B(2, 5)
B(2, 5) implies 2^5 or 32 bit sequences. There are 2^11 or 2,048 odd 32-bit sequences with 32 overlapping unique five-bit subsequences, for instance 0x076be629B(2, 6)
B(2, 6) implies 2^6 or 64 bit sequences. There are 2^26 or 67,108,864 odd 64-bit sequences with 64 overlapping unique six-bit subsequences, for instance 0x022fdd63cc95386dDe Bruijn Graphs
A De Bruijn graph is a directed graph representing overlaps between sequences of symbols [6] .B(2, 4) Graph
De Bruijn Graph on a Chess Board
A directed De Bruijn Graph of B(2, 6) sequences with Little-Endian Rank-File Mapping board coordinates (a1 = 0, b1 = 1, h8 = 63). For topology reasons, almost each node (except a1 and h8) of the graph is deconcentrated and appears twice in the form of two reversed binary trees. The leaf outputs join the respective reversed tree. Between c6 and f3 is a direct cycle, since 42 is 2*21 and 21 is (2*42 + 1) % 64, with both six-bit pattern reversed - 010101 (21) versus 101010 (42). The challenge is to traverse the graph in any way to visit each of the 64 nodes aka squares exactly once.+----------------->---------------a1--------------<-----------------+ | | | | b1 | | +--------------/ \-------------+ | | c1 d1 | ^ +-----/ \-----+ +-----/ \-----+ | | e1 f1 g1 h1 | | +-/ \-+ +-/ \-+ +-/ \-+ +-/ \-+ | | a2 b2 c2 d2 e2 f2 g2 h2 | | a3 b3 c3 d3 e3 |f3| g3 h3 a4 b4 c4 d4 e4 f4 g4 h4 | +-a5b5c5d5e5f5g5h5a6b6c6d6e6f6g6h6 a7b7c7d7e7f7g7h7a8b8c8d8e8f8 | | ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ | | | | +----------------->---------------h8--------------<--------------+ ^ | | | | g8 | | +--------------/ \-------------+ | | f8 e8 | ^ +-----/ \-----+ +-----/ \-----+ | | d8 c8 b8 a8 | | +-/ \-+ +-/ \-+ +-/ \-+ +-/ \-+ | | h7 g7 f7 e7 d7 c7 b7 a7 | | h6 g6 f6 e6 d6 |c6| b6 a6 h5 g5 f5 e5 d5 c5 b5 a5--+ +-h4g4f4e4d4c4b4a4h3g3f3e3d3c3b3a3 h2g2f2e2d2c2b2a2h1g1f1e1d1c1 ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^De Bruijn Networks
So called De Bruijn Networks with the topology of De Bruijn Graphs have interesting properties in processor and computer networks, for instance as described by Feldmann et al. to connect Transputer networks [7] [8] .See also
Selected Publications
1894
1946
1950 ...
1970 ...
1990 ...
2000 ...
2010 ...
External Links
References
What links here?
Up one Level