138 research outputs found

    Generation, Ranking and Unranking of Ordered Trees with Degree Bounds

    Full text link
    We study the problem of generating, ranking and unranking of unlabeled ordered trees whose nodes have maximum degree of Δ\Delta. 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 Δ\Delta 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 Δ\Delta. 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 Δ\Delta is constant), both ranking and unranking algorithms are also designed taking O(n) and O(nlogn) time complexities.Comment: In Proceedings DCM 2015, arXiv:1603.0053

    Boltzmann samplers for random generation of lambda terms

    Get PDF
    Randomly generating structured objects is important in testing and optimizing functional programs, whereas generating random l'l-terms is more specifically needed for testing and optimizing compilers. For that a tool called QuickCheck has been proposed, but in this tool the control of the random generation is left to the programmer. Ten years ago, a method called Boltzmann samplers has been proposed to generate combinatorial structures. In this paper, we show how Boltzmann samplers can be developed to generate lambda-terms, but also other data structures like trees. These samplers rely on a critical value which parameters the main random selector and which is exhibited here with explanations on how it is computed. Haskell programs are proposed to show how samplers are actually implemented

    Efficient indexing of necklaces and irreducible polynomials over finite fields

    Full text link
    We study the problem of indexing irreducible polynomials over finite fields, and give the first efficient algorithm for this problem. Specifically, we show the existence of poly(n, log q)-size circuits that compute a bijection between {1, ... , |S|} and the set S of all irreducible, monic, univariate polynomials of degree n over a finite field F_q. This has applications in pseudorandomness, and answers an open question of Alon, Goldreich, H{\aa}stad and Peralta[AGHP]. Our approach uses a connection between irreducible polynomials and necklaces ( equivalence classes of strings under cyclic rotation). Along the way, we give the first efficient algorithm for indexing necklaces of a given length over a given alphabet, which may be of independent interest

    Counting and Generating Terms in the Binary Lambda Calculus (Extended version)

    Get PDF
    In a paper entitled Binary lambda calculus and combinatory logic, John Tromp presents a simple way of encoding lambda calculus terms as binary sequences. In what follows, we study the numbers of binary strings of a given size that represent lambda terms and derive results from their generating functions, especially that the number of terms of size n grows roughly like 1.963447954. .. n. In a second part we use this approach to generate random lambda terms using Boltzmann samplers.Comment: extended version of arXiv:1401.037

    Binary Decision Diagrams: from Tree Compaction to Sampling

    Full text link
    Any Boolean function corresponds with a complete full binary decision tree. This tree can in turn be represented in a maximally compact form as a direct acyclic graph where common subtrees are factored and shared, keeping only one copy of each unique subtree. This yields the celebrated and widely used structure called reduced ordered binary decision diagram (ROBDD). We propose to revisit the classical compaction process to give a new way of enumerating ROBDDs of a given size without considering fully expanded trees and the compaction step. Our method also provides an unranking procedure for the set of ROBDDs. As a by-product we get a random uniform and exhaustive sampler for ROBDDs for a given number of variables and size

    Generation of Neuronal Trees by a New Three Letters Encoding

    Get PDF
    A neuronal tree is a rooted tree with n leaves whose each internal node has at least two children; this class not only is defined based on the structure of dendrites in neurons, but also refers to phylogenetic trees or evolutionary trees. More precisely, neuronal trees are rooted-multistate phylogenetic trees whose size is defined as the number of leaves. In this paper, a new encoding over an alphabet of size 3 (minimal cardinality) is introduced for representing the neuronal trees with a given number of leaves. This encoding is used for generating neuronal trees with n leaves in A-order with constant average time and O(n) time complexity in the worst case. Also, new ranking and unranking algorithms are presented in time complexity of O(n) and O(n log n), respectively
    corecore