arXiv++ Combinatorics

Browse math.CO papers from arXiv

Papers by Daniel Gabrić

17 paper(s) by this author · All BibTeX
2026-07-06
Necklaces and Lyndon words in colexicographic order
We present the first constant-amortized-time algorithms for generating all length-$n$ necklaces and Lyndon words over a $k$-letter alphabet in colexicographic order, for arbitrary $k\geq 2$. Our approach introduces a novel class of words called \emph{quasinecklaces}, which serve as an easily generated superset of necklaces through which all necklaces can be efficiently identified. We derive a formula for the number $Q_k(n)$ of length-$n$ quasinecklaces and show that $Q_k(n)$ is proportional to the number of length-$n$ necklaces, which is the key property needed to achieve constant amortized time. We also apply our results to efficiently generate a well-known de Bruijn sequence and efficiently generate necklaces and Lyndon words subject to a weight constraint.
Decoding universal cycles for t-subsets and t-multisets by decoding bounded-weight de Bruijn sequences
A universal cycle for a set S of combinatorial objects is a cyclic sequence of length |S| that contains a representative of each element in S exactly once as a substring. Despite the many universal cycle constructions known in the literature for various sets including k-ary strings of length n, permutations of order n, t-subsets of an n-set, and t-multisets of an n-set, remarkably few have efficient decoding (ranking/unranking) algorithms. In this paper we develop the first polynomial time/space decoding algorithms for bounded-weight de Bruijn sequences for strings of length nover an alphabet of size k. The results are then applied to decode universal cycles for t-subsets and t-multisets.
2025-10-18 v3
Las Vegas algorithms to generate universal cycles and de Bruijn sequences uniformly at random
We present practical algorithms for generating universal cycles uniformly at random. In particular, we consider universal cycles for shorthand permutations, subsets and multiset permutations, weak orders, and orientable sequences. Additionally, we consider de Bruijn sequences, weight-range de Bruin sequences, and de Bruijn sequences, with forbidden $0^z$ substring. Each algorithm, seeded with a random element from the given set, applies a random walk of an underlying Eulerian de Bruijn graph to obtain a random arborescence (spanning in-tree). Given the random arborescence and the de Bruijn graph, a corresponding random universal cycle can be generated in constant time per symbol. We present experimental results on the average cover time needed to compute a random arborescence for each object using a Las Vegas algorithm.
2024-07-09
Constructing $k$-ary Orientable Sequences with Asymptotically Optimal Length
An orientable sequence of order $n$ over an alphabet $\{0,1,\ldots, k{-}1\}$ is a cyclic sequence such that each length-$n$ substring appears at most once \emph{in either direction}. When $k= 2$, efficient algorithms are known to construct binary orientable sequences, with asymptotically optimal length, by applying the classic cycle-joining technique. The key to the construction is the definition of a parent rule to construct a cycle-joining tree of asymmetric bracelets. Unfortunately, the parent rule does not generalize to larger alphabets. Furthermore, unlike the binary case, a cycle-joining tree does not immediately lead to a simple successor-rule when $k \geq 3$ unless the tree has certain properties. In this paper, we derive a parent rule to derive a cycle-joining tree of $k$-ary asymmetric bracelets. This leads to a successor rule that constructs asymptotically optimal $k$-ary orientable sequences in $O(n)$ time per symbol using $O(n)$ space. In the special case when $n=2$, we provide a simple construction of $k$-ary orientable sequences of maximal length.
2024-01-25 v3
Construction of orientable sequences in $O(1)$-amortized time per bit
An orientable sequence of order $n$ is a cyclic binary sequence such that each length-$n$ substring appears at most once \emph{in either direction}. Maximal length orientable sequences are known only for $n\leq 7$, and a trivial upper bound on their length is $2^{n-1} - 2^{\lfloor(n-1)/2\rfloor}$. This paper presents the first efficient algorithm to construct orientable sequences with asymptotically optimal length; more specifically, our algorithm constructs orientable sequences via cycle-joining and a successor-rule approach requiring $O(n)$ time per bit and $O(n)$ space. This answers a longstanding open question from Dai, Martin, Robshaw, Wild [Cryptography and Coding III (1993)]. Applying a recent concatenation-tree framework, the same sequences can be generated in $O(1)$-amortized time per bit using $O(n^2)$ space. Our sequences are applied to find new longest-known (aperiodic) orientable sequences for $n\leq 20$.
2023-02-25 v2
Smallest and Largest Block Palindrome Factorizations
A \emph{palindrome} is a word that reads the same forwards and backwards. A \emph{block palindrome factorization} (or \emph{BP-factorization}) is a factorization of a word into blocks that becomes palindrome if each identical block is replaced by a distinct symbol. We call the number of blocks in a BP-factorization the \emph{width} of the BP-factorization. The \emph{largest BP-factorization} of a word $w$ is the BP-factorization of $w$ with the maximum width. We study words with certain BP-factorizations. First, we give a recurrence for the number of length-$n$ words with largest BP-factorization of width $t$. Second, we show that the expected width of the largest BP-factorization of a word tends to a constant. Third, we give some results on another extremal variation of BP-factorization, the \emph{smallest BP-factorization}. A \emph{border} of a word $w$ is a non-empty word that is both a proper prefix and suffix of $w$. Finally, we conclude by showing a connection between words with a unique border and words whose smallest and largest BP-factorizations coincide.
2022-06-28 v3
Asymptotic bounds for the number of closed and privileged words
A word~$w$ has a border $u$ if $u$ is a non-empty proper prefix and suffix of $u$. A word~$w$ is said to be \emph{closed} if $w$ is of length at most $1$ or if $w$ has a border that occurs exactly twice in $w$. A word~$w$ is said to be \emph{privileged} if $w$ is of length at most $1$ or if $w$ has a privileged border that occurs exactly twice in $w$. Let $C_k(n)$ (resp.~$P_k(n)$) be the number of length-$n$ closed (resp. privileged) words over a $k$-letter alphabet. In this paper, we improve existing upper and lower bounds on $C_k(n)$ and $P_k(n)$. We completely resolve the asymptotic behaviour of $C_k(n)$. We also nearly completely resolve the asymptotic behaviour of $P_k(n)$ by giving a family of upper and lower bounds that are separated by a factor that grows arbitrarily slowly.
2021-10-03 v2
Words that almost commute
Published • View PublicationBIB
The \emph{Hamming distance} $\text{ham}(u,v)$ between two equal-length words $u$, $v$ is the number of positions where $u$ and $v$ differ. The words $u$ and $v$ are said to be \emph{conjugates} if there exist non-empty words $x,y$ such that $u=xy$ and $v=yx$. The smallest value $\text{ham}(xy,yx)$ can take on is $0$, when $x$ and $y$ commute. But, interestingly, the next smallest value $\text{ham}(xy,yx)$ can take on is $2$ and not $1$. In this paper, we consider conjugates $u=xy$ and $v=yx$ where $\text{ham}(xy,yx)=2$. More specifically, we provide an efficient formula to count the number $h(n)$ of length-$n$ words $u=xy$ over a $k$-letter alphabet that have a conjugate $v=yx$ such that $\text{ham}(xy,yx)=2$. We also provide efficient formulae for other quantities closely related to $h(n)$. Finally, we show that there is no one easily-expressible good bound on the growth of $h(n)$.
2020-10-27 v2
Mutual Borders and Overlaps
Published • View PublicationBIB
A word is said to be \emph{bordered} if it contains a non-empty proper prefix that is also a suffix. We can naturally extend this definition to pairs of non-empty words. A pair of words $(u,v)$ is said to be \emph{mutually bordered} if there exists a word that is a non-empty proper prefix of $u$ and suffix of $v$, and there exists a word that is a non-empty proper suffix of $u$ and prefix of $v$. In other words, $(u,v)$ is mutually bordered if $u$ overlaps $v$ and $v$ overlaps $u$. We give a recurrence for the number of mutually bordered pairs of words. Furthermore, we show that, asymptotically, there are $c\cdot k^{2n}$ mutually bordered words of length-$n$ over a $k$-letter alphabet, where $c$ is a constant. Finally, we show that the expected shortest overlap between pairs of words is bounded above by a constant.
2020-07-16
The Simplest Binary Word with Only Three Squares
Published • View PublicationBIB
We re-examine previous constructions of infinite binary words containing few distinct squares with the goal of finding the "simplest", in a certain sense. We exhibit several new constructions. Rather than using tedious case-based arguments to prove that the constructions have the desired property, we rely instead on theorem-proving software for their correctness.
2020-05-24 v2
An inequality for the number of periods in a word
Published • View PublicationBIB
We prove an inequality for the number of periods in a word x in terms of the length of x and its initial critical exponent. Next, we characterize all periods of the length-n prefix of a characteristic Sturmian word in terms of the lazy Ostrowski representation of n, and use this result to show that our inequality is tight for infinitely many words x. We propose two related measures of periodicity for infinite words. Finally, we also consider special cases where x is overlap-free or squarefree.
2020-05-04 v2
Investigating the discrepancy property of de Bruijn sequences
Published • View PublicationBIB
The discrepancy of a binary string refers to the maximum (absolute) difference between the number of ones and the number of zeroes over all possible substrings of the given binary string. We provide an investigation of the discrepancy of known simple constructions of de Bruijn sequences. Furthermore, we demonstrate constructions that attain the lower bound of $Θ(n)$ and a new construction that attains the previously known upper bound of $Θ(\frac{2^n}{\sqrt{n}})$. This extends the work of Cooper and Heitsch~[\emph{Discrete Mathematics}, 310 (2010)].
2020-02-05 v2
Avoidance of split overlaps
Published • View PublicationBIB
We generalize Axel Thue's familiar definition of overlaps in words, and show that there are no infinite words containing split occurrences of these generalized overlaps. Along the way we prove a useful theorem about repeated disjoint occurrences in words -- an interesting natural variation on the classical de Bruijn sequences.
2019-06-09 v2
Borders, Palindrome Prefixes, and Square Prefixes
Published • View PublicationBIB
We show that the number of length-n words over a k-letter alphabet having no even palindromic prefix is the same as the number of length-n unbordered words, by constructing an explicit bijection between the two sets. A slightly different but analogous result holds for those words having no odd palindromic prefix. Using known results on borders, we get an asymptotic enumeration for the number of words having no even (resp., odd) palindromic prefix . We obtain an analogous result for words having no nontrivial palindromic prefix. Finally, we obtain similar results for words having no square prefix, thus proving a 2013 conjecture of Chaffin, Linderman, Sloane, and Wilks.
2019-04-17
Circularly squarefree words and unbordered conjugates: a new approach
Using a new approach based on automatic sequences, logic, and a decision procedure, we reprove some old theorems about circularly squarefree words and unbordered conjugates in a new and simpler way. Furthermore, we prove three new results about unbordered conjugates: we complete the classification, due to Harju and Nowotka, of binary words with the maximum number of unbordered conjugates; we prove that for every possible number, up to the maximum, there exists a word having that number of unbordered conjugates, and finally, we determine the expected number of unbordered conjugates in a random word.
2019-03-13 v2
Maximal State Complexity and Generalized de Bruijn Words
We compute the exact maximum state complexity for the language consisting of $m$ words of length $N$, and characterize languages achieving the maximum. We also consider a special case, namely languages $C(w)$ consisting of the conjugates of a single word $w$. The words for which the maximum state complexity of $C(w)$ is achieved turn out to be a natural generalization of de Bruijn words. We show that generalized de Bruijn words exist for each length and consider the number of them.
2018-03-23 v2
Constructing de Bruijn sequences by concatenating smaller universal cycles
Published • View PublicationBIB
We present sufficient conditions for when an ordering of universal cycles $α_1, α_2, \ldots, α_m$ for disjoint sets $\mathbf{S}_1, \mathbf{S}_2, \ldots , \mathbf{S}_m$ can be concatenated together to obtain a universal cycle for $\mathbf{S} = \mathbf{S}_1 \cup \mathbf{S}_2 \cup \cdots \cup \mathbf{S}_m$. When $\mathbf{S}$ is the set of all $k$-ary strings of length $n$, the result of such a successful construction is a de Bruijn sequence. Our conditions are applied to generalize two previously known de Bruijn sequence constructions and then they are applied to develop three new de Bruijn sequence constructions.