De Bruijn Sequence

A k-ary De Bruijn sequence of order n is a circular k-ary string containing every k-ary string of length n as a substring exactly once. Thus a De Bruijn sequence has length kn. For n = 3 and k = 2, the lexicographically smallest De Bruijn sequence is 00010111.

如果k = 2, 则就叫binary De Bruijn sequence(下面简称DB序列). n阶的k叉DB序列: 长度为 kn ,每个子串长度为n。从左到右按子串遍历,没有一个子串是重复的。

n = 3 and k = 2 的DB序列00010111,从左到右按子串遍历:000, 001, 010, 101, 011, 111, 110, 100。 我们可以看到,这几个子串没有一个是重复的。

 

Every De Bruijn sequence corresponds to a Eulerian cycle on a De Bruijn graph, one of which is shown below (for n = 3 and k = 2).

可以用DB图来构造DB序列,先构造DB图,然后找一个结点没有重复的回路就能构成DB序列。

以构造n = 3 and k = 2 的DB图为例:

step1: 写出所有可能的子串,如这里就是8种:000, 001, 010, 101, 011, 111, 110, 100

step2: 先摆好第一个结点,如000,它下一个子串的可能是000, 001;其中000是重复的,所以无需找它接下来的子串。我们看001,它下一个子串的可能是010, 011。 以此类推, 构成的图如上所示。

找结点没有重复的回路: 000, 001, 011, 111, 110, 101, 010, 100

故该回路对应的DB序列为:00011101。

 

At first glance De Bruijn sequences appear to have little to do with necklaces or Lyndon words. However, Fredericksen has proven that the lexicographic sequence of Lyndon words of lengths divisible by n gives the lexicographically least De Bruijn sequence, and that is the one output by our program.

The algorithm used is from the Combinatorial Generation book. It is a recursive algorithm and generates necklaces in lexicographic order, as does the first efficient necklace generation algorithm, the iterative algorithm of Fredricksen, Maiorana, and Kelsen.

 

Reference Website: http://www.theory.csc.uvic.ca/~cos/inf/neck/NecklaceInfo.html

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值