Starting from a succession rule for Catalan numbers, we define a procedure encoding and listing the objects enumerated by these numbers such that two consecutive codes of the list differ only for one digit. Gray code we obtain can be generalized to all the succession rules with the stability property: each label $(k)$ has in its production two labels $c_1$ and $c_2$, always in the same position, regardless of $k$. Because of this link, we define Gray structures the sets of those combinatorial objects whose construction can be encoded by a succession rule with the stability property. This property is a characteristic that can be found among various succession rules, as the finite, factorial or transcendental ones. We also indicate an algorithm which is a very slight modification of the Walsh's one, working in a O(1) worst-case time per word for generating Gray codes.
A Gray code for a combinatorial class is a method for listing the objects in the class so that successive objects differ in some prespecified, small way, typically expressed as a bounded Hamming distance. In a previous work, the authors of the present paper showed, among other things, that the $m$-ary Reflected Gray Code Order yields a Gray code for the set of restricted growth functions. Here we further investigate variations of this order relation, and give the first Gray codes and efficient generating algorithms for bounded restricted growth functions.
The past decade has seen a flurry of research into pattern avoiding permutations but little of it is concerned with their exhaustive generation. Many applications call for exhaustive generation of permutations subject to various constraints or imposing a particular generating order. In this paper we present generating algorithms and combinatorial Gray codes for several families of pattern avoiding permutations. Among the families under consideration are those counted by Catalan, Schröder, Pell, even index Fibonacci numbers and the central binomial coefficients. Consequently, this provides Gray…
We consider two order relations: that induced by the m-ary reflected Gray code and a suffix partitioned variation of it. We show that both of them when applied to some sets of restricted growth sequences still yield Gray codes. These sets of sequences are: subexcedant or ascent sequences, restricted growth functions, and staircase words. In each case we give efficient exhaustive generating algorithms and compare the obtained results.
A permutomino of size n is a polyomino determined by a pair of permutations of size n+1, such that they differ in each position. In this paper, after recalling some enumerative results about permutominoes, we give a first algorithm for the exhaustive generation of a particular class of permutominoes, the convex permutominoes, proving that its cost is proportional to the number of generated objects.
In 1986 S. Sattolo introduced a simple algorithm for uniform random generation of cyclic permutations on a fixed number of symbols. This algorithm is very similar to the standard method for generating a random permutation, but is less well known. We consider both methods in a unified way, and discuss their relation with exhaustive generation methods. We analyse several random variables associated with the algorithms and find their grand probability generating functions, which gives easy access to moments and limit laws.
An $n$-length binary word is $q$-decreasing, $q\geq 1$, if every of its length maximal factor of the form $0^a1^b$ satisfies $a=0$ or $q\cdot a > b$.We show constructively that these words are in bijection with binary words having no occurrences of $1^{q+1}$, and thus they are enumerated by the $(q+1)$-generalized Fibonacci numbers. We give some enumerative results and reveal similarities between $q$-decreasing words and binary words having no occurrences of $1^{q+1}$ in terms of frequency of $1$ bit. In the second part of our paper, we provide an efficient exhaustive generating algorithm for …
Dissections of a square into smaller squares, with the smaller squares having relatively prime sizes, are known as Mrs Perkins's quilts. A representation of these dissections using graphs is presented. The edges are directed and coloured North-South or West-East, and the graph corresponds naturally to the dissection. This representation allowed the exhaustive generation of all dissections up to order 18, using the plantri software. The results were cross-checked by generating all dissections of small sizes using a direct approach. The results confirm, extend and introduce several integer seque…
In this paper we present a CAT generation algorithm for Dyck paths with a fixed length n. It is the formalization of a method for the exhaustive generation of this kind of paths which can be described by means of two equivalent strategies. The former is described by a rooted tree, the latter lists the paths by means of three operations which, as we are going to see, are equivalent to visit the tree. These constructions are strictly connected with ECO method and can be encoded by a rule, very similar to the succession rule in ECO, with a finite number of labels for each n. Moreover with a sligh…
We use a greedy strategy to list the spanning trees of the fan graph, $F_n$, such that successive trees differ by pivoting a single edge around a vertex. It is the first greedy algorithm for exhaustively generating spanning trees using such a minimal change operation. The resulting listing is then studied to find a recursive algorithm that produces the same listing in $O(1)$-amortized time using $O(n)$ space. Additionally, we present $O(n)$-time algorithms for ranking and unranking the spanning trees for our listing; an improvement over the generic $O(n^3)$-time algorithm for ranking and unran…
We consider the problem of listing all spanning trees of a graph $G$ such that successive trees differ by pivoting a single edge around a vertex. Such a listing is called a "pivot Gray code", and it has more stringent conditions than known "revolving-door" Gray codes for spanning trees. Most revolving-door algorithms employ a standard edge-deletion/edge-contraction recursive approach which we demonstrate presents natural challenges when requiring the "pivot" property. Our main result is the discovery of a greedy strategy to list the spanning trees of the fan graph in a pivot Gray code order. I…
Given integers $k\geq 2$ and $a_1,\ldots,a_k\geq 1$, let $\boldsymbol{a}:=(a_1,\ldots,a_k)$ and $n:=a_1+\cdots+a_k$. An $\boldsymbol{a}$-multiset permutation is a string of length $n$ that contains exactly $a_i$ symbols $i$ for each $i=1,\ldots,k$. In this work we consider the problem of exhaustively generating all $\boldsymbol{a}$-multiset permutations by star transpositions, i.e., in each step, the first entry of the string is transposed with any other entry distinct from the first one. This is a far-ranging generalization of several known results. For example, it is known that permutations …
Despite the fact that the field of pattern avoiding permutations has been skyrocketing over the last two decades, there are very few exhaustive generating algorithms for such classes of permutations. In this paper we introduce the notions of regular and colored regular set of forbidden patterns, which are particular cases of right-justified sets of forbidden patterns. We show the (colored) regularity of several sets of forbidden patterns (some of them involving variable length patterns) and we derive a general framework for the efficient generation of permutations avoiding them. The obtained g…
In this work we present a general and versatile algorithmic framework for exhaustively generating a large variety of different combinatorial objects, based on encoding them as permutations. This approach provides a unified view on many known results and allows us to prove many new ones. In particular, we obtain four classical Gray codes for permutations, bitstrings, binary trees and set partitions as special cases. We present two distinct applications for our new framework: The first main application is the generation of pattern-avoiding permutations, yielding new Gray codes for different fami…
We describe an algorithm for generating all $k$-critical $\mathcal H$-free graphs, based on a method of Hoàng et al. Using this algorithm, we prove that there are only finitely many $4$-critical $(P_7,C_k)$-free graphs, for both $k=4$ and $k=5$. We also show that there are only finitely many $4$-critical graphs $(P_8,C_4)$-free graphs. For each case of these cases we also give the complete lists of critical graphs and vertex-critical graphs. These results generalize previous work by Hell and Huang, and yield certifying algorithms for the $3$-colorability problem in the respective classes. More…
In 1993, Savage, Squire, and West described an inductive construction for generating every acyclic orientation of a chordal graph exactly once, flipping one arc at a time. We provide two generalizations of this result. Firstly, we describe Gray codes for acyclic orientations of hypergraphs that satisfy a simple ordering condition, which generalizes the notion of perfect elimination order of graphs. This unifies the Savage-Squire-West construction with a recent algorithm for generating elimination trees of chordal graphs. Secondly, we consider quotients of lattices of acyclic orientations of ch…
In this paper we propose an algorithm to generate binary words with no more 0's than 1's having a fixed number of 1's and avoiding the pattern $(10)^j1$ for any fixed $j \geq 1$. We will prove that this generation is exhaustive, that is, all such binary words are generated.
We describe a generating tree approach to the enumeration and exhaustive generation of k-nonnesting set partitions and permutations. Unlike previous work in the literature using the connections of these objects to Young tableaux and restricted lattice walks, our approach deals directly with partition and permutation diagrams. We provide explicit functional equations for the generating functions, with k as a parameter.
A generic rectangulation is a partition of a rectangle into finitely many interior-disjoint rectangles, such that no four rectangles meet in a point. In this work we present a versatile algorithmic framework for exhaustively generating a large variety of different classes of generic rectangulations. Our algorithms work under very mild assumptions, and apply to a large number of rectangulation classes known from the literature, such as generic rectangulations, diagonal rectangulations, 1-sided/area-universal, block-aligned rectangulations, and their guillotine variants, including aspect-ratio-u…
The Sand Pile Model (SPM) and its generalization, the Ice Pile Model (IPM), originate from physics and have various applications in the description of the evolution of granular systems. In this article, we deal with the enumeration and the exhaustive generation of the accessible configuration of the system. Our work is based on a new recursive decomposition theorem for SPM configurations using the notion of staircase bases. Based on this theorem, we provide a recursive formula for the enumeration of SPM(n) and a constant amortized time (CAT) algorithm for the generation of all SPM(n) configura…