Lexicographic generation of ordered trees (original) (raw)
Related papers
Theoretical Computer Science, 1988
A ct. A new algorithm for generating all ordered trees on n nodes, is developed. It is a nonrecursive algorithm which, without any assistance of codewords or any other combinatorial representation, directly generait-; all trees on PS nodes, in average time 0( 1) per transforms one tree into another in the following wpny: it finds a unique transfo performs one node degradation operation, folfowed optionally by one path average length of path to be compressed is lest :%I #. There is a coding of trees in whick the algorithm produces trees in the lexicographic
Ranking and Unranking Algorithms for k-ary Trees in Gray Code Order
2012
In this paper, we present two new ranking and unranking algorithms for k-ary trees represented by x-sequences in Gray code order. These algorithms are based on a gray code generation algorithm developed by Ahrabian et al.. In mentioned paper, a recursive backtracking generation algorithm for x-sequences corresponding to k-ary trees in Gray code was presented. This generation algorithm is based on Vajnovszki’s algorithm for generating binary trees in Gray code ordering. Up to our knowledge no ranking and unranking algorithms were given for x-sequences in this ordering. we present ranking and unranking algorithms with O(kn) time complexity for x-sequences in this Gray code ordering . Keywords—k-ary Tree Generation, Ranking, Unranking, Gray Code.
An Efficient Scheme for the Generation of Ordered Trees in Constant Amortized Time
2021 15th International Conference on Ubiquitous Information Management and Communication (IMCOM), 2021
Trees are useful entities allowing to model data structures and hierarchical relationships in networked decision systems ubiquitously. An ordered tree is a rooted tree where the order of the subtrees (children) of a node is significant. In combinatorial optimization, generating ordered trees is relevant to evaluate candidate combinatorial objects. In this paper, we present an algebraic scheme to generate ordered trees with n vertices with utmost efficiency; whereby our approach uses O(n) space and O(1) time in average per tree. Our computational studies have shown the feasibility and efficiency to generate ordered trees in constant time in average, in about one tenth of a millisecond per ordered tree. Due to the 1-1 bijective nature to other combinatorial classes, our approach is favorable to study the generation of binary trees with n external nodes, trees with n nodes, legal sequences of n pairs of parentheses, triangulated n-gons, gambler's sequences and lattice paths. We believe our scheme may find its use in devising algorithms for planning and combinatorial optimization involving Catalan numbers.
Generation, Ranking and Unranking of Ordered Trees with Degree Bounds
Electronic Proceedings in Theoretical Computer Science, 2016
We study the problem of generating, ranking and unranking of unlabeled ordered trees whose nodes have maximum degree of ∆. This class of trees represents a generalization of chemical trees. A chemical tree is an unlabeled tree in which no node has degree greater than 4. By allowing up to ∆ children for each node of chemical tree instead of 4, we will have a generalization of chemical trees. Here, we introduce a new encoding over an alphabet of size 4 for representing unlabeled ordered trees with maximum degree of ∆. We use this encoding for generating these trees in A-order with constant average time and O(n) worst case time. Due to the given encoding, with a precomputation of size and time O(n 2) (assuming ∆ is constant), both ranking and unranking algorithms are also designed taking O(n) and O(n log n) time complexities.
Towards a More Precise Analysis of an Algorithm to Generate Binary Trees: A Tutorial
The Computer Journal, 1998
For the analysis of an algorithm to generate binary trees, the behaviour of a certain sequence of numbers is essential. In the original paper, it was expressed by a recursion. Here, we show how to solve this (and similar) recursions, both explicitly and asymptotically. Some additional information about useful mathematical software is also provided.
On Two Ways of Enumerating Ordered Trees
arXiv (Cornell University), 2010
The middle-levels graph M k (0 < k ∈ Z) has a dihedral quotient pseudograph R k whose vertices are the k-edge ordered trees T , each T encoded as a (2k +1)-string F (T) formed via →DFS by: (i) (←BFS-assigned) Kierstead-Trotter lexical colors 0,. .. , k for the descending nodes; (ii) asterisks * for the k ascending edges. Two ways of corresponding a restricted-growth k-string α to each T exist, namely one Stanley's way and a novel way that assigns F (T) to α via nested substring-swaps. These swaps permit to sort V (R k) as an ordered tree that allows a lexical visualization of M k as well as the Hamilton cycles of M k constructed by P. Gregor, T. Mütze and J. Nummenpalo.
Parallel Generation of t-Ary Trees in A-order
The Computer Journal, 2007
We present a cost-optimal and adaptive parallel algorithm for generating t-ary trees in A-order. The generation is based on an encoding using integer sequences (z-sequences) due to Zaks [(1980), Lexicographic generation of ordered tree. Theor. Comput. Sci., 10, 63-82]. Our algorithm is the first introduced parallel generation algorithm, which generates t-ary trees in A-order in the literature. The used computational model is CREW SM SIMD multi-processors. This algorithm is designed based on a novel sequential generation algorithm that is also discussed. Ranking and unranking algorithms for z-sequences are also presented.
In this paper, a new representation of a binary tree is introduced, called the Catalan Cipher Vector, which is a vector of n elements with certain properties. It can be ranked using a special form of the Catalan Triangle designed for this purpose. It is shown that the vector coincides with the level-order traversal of the binary tree and how it can be used to generate a binary tree from it. Streamlined algorithms for directly obtaining the rank from a binary tree and vice versa, using the Catalan Cipher Vector during the processes, are given. The algorithms are analyzed for time and space complexity and shown to be linear for both. The Catalan Cipher Vector enables a straightforward determination of the position and linking for every node of the binary tree, since it contains information for both every node’s ancestor and the direction of linking from the ancestor to that node. Thus, it is especially well suited for binary tree generation. Using another structure, called a canonical state-space tableau, the relationship between the Catalan Cipher Vector and the level-order traversal of the binary tree is explained.
Loopless generation of k-ary tree sequences
Information Processing Letters, 1994
Roelants van Baronaigien (1991) gave an algorithm to generate all n-node binary tree representations with constant time between them. He used the well-known rotation operation on nodes for balancing binary search trees and represented binary trees by binary tree sequences. This paper generalizes the rotation to k-ary trees and uses it to generate k-ary tree representations with constant time between them.