---
title: Unoriented De Bruijn Sequences
url: https://www.emergentmind.com/topics/unoriented-de-bruijn-sequences
type: topic
---

# Unoriented De Bruijn Sequences

An unoriented de Bruijn sequence, also known as a CR-invariant or direction-blind de Bruijn sequence, is a sequence over a $k$-symbol alphabet in which each reflected equivalence class $[v]$ of length-$n$ words appears exactly once as a length-$n$ contiguous subword when the sequence is read both forwards and backwards. This property distinguishes unoriented sequences from classical de Bruijn sequences, which list all words of length $n$ only in a single orientation. The concept is defined formally as a minimal-length sequence $W$ such that for every reflected pair $[v] = \{v, v'\}$, with $v'$ denoting the reversal of $v$, exactly one member of the pair appears as a contiguous subword in $W$ or its reversal. Unoriented de Bruijn sequences arise naturally in combinatorial design, coding theory, and theoretical computer science, particularly in contexts where orientation or directionality is irrelevant or ambiguous [1608.08480].

## 1. Reflected Pairs and Sequence Structure

Let $\Sigma_k = \{0,1,\dots,k-1\}$ be the $k$-letter alphabet. For any $v = v_1v_2\cdots v_n \in \Sigma_k^n$, its reflection is defined by $v' = v_nv_{n-1}\cdots v_1$. The equivalence class $[v]$ comprises the pair $\{v,v'\}$, with palindromic words forming singleton classes. The unoriented de Bruijn sequence $uB(k,n)$ ensures that, for each distinct $[v]$ of length $n$, exactly one of $v$ or $v'$ appears as a subword in $W$ (possibly in $W$ or its reverse), with palindromic representatives appearing only once.

The minimal length $l(k,n)$ of such a sequence can be explicitly computed as:
$$
l(k,n) = \frac{1}{2}(k^n + k^{\lceil n/2 \rceil}) + (n-1) = \frac{ k^n + k^{\lceil n/2 \rceil} + 2n - 2 }{2}
$$
This formula captures the count of reflected pairs plus the overlap needed at the sequence ends.

## 2. The Unoriented de Bruijn Graph

The central combinatorial tool is the unoriented de Bruijn graph, $\mathrm{UBG}(k,n)$, an undirected multigraph where:

- **Vertices:** Each vertex is labeled by a reflected pair $[u]$ of length-$(n-1)$ words ($|V| = \frac{1}{2}(k^{n-1} + k^{\lceil (n-1)/2\rceil})$).
- **Edges:** Each edge is labeled by a reflected pair $[e]$ of length-$n$ words ($|E| = \frac{1}{2}(k^n + k^{\lceil n/2\rceil})$).

An edge $[e]$ connects the vertices $[v] = [\operatorname{prefix}(e)]$ and $[w] = [\operatorname{suffix}(e)]$, where $\operatorname{prefix}(e)$ and $\operatorname{suffix}(e)$ are the first and last $n-1$ symbols of $e$, respectively. Loops arise when the prefix and suffix represent the same reflected pair, which happens precisely when one is the reversal of the other.

For a rigorous tracking of information, each edge incidence at a non-palindromic vertex is classified as either Type I (prefix or its reflected pair) or Type II (suffix or reflected pair).

## 3. Existence and Optimality Criteria

An unoriented de Bruijn sequence of optimal length exists if and only if the $\mathrm{UBG}(k,n)$ admits an alternating Eulerian path, i.e., an Eulerian path alternating at each non-palindromic vertex between Type I and Type II incidences. The condition is satisfied precisely when the number of odd-degree vertices in $\mathrm{UBG}(k,n)$, denoted $\operatorname{ov}(k,n)$, is at most two, with additional local parity constraints for alternation.

Key results [1608.08480]:
- For $k=2$ or $k$ odd and $n\le 3$, $\operatorname{ov}(k,n)\leq 2$, and hence unoriented de Bruijn sequences of optimal length exist.
- For $k$ even with $k>2$ or $n>3$, more than two odd-degree vertices occur, precluding optimal alternating Eulerian paths without further modifications.

Explicitly, for $k$ odd and $n$ even,
$$
\operatorname{ov}(k,n) = 2\cdot(k^{n/2} - k)
$$
which is only at most two for small parameter values. This parity argument governs existence of optimal sequences.

## 4. Algorithmic Construction via Alternating Eulerian

Source: https://www.emergentmind.com/topics/unoriented-de-bruijn-sequences