38 research outputs found
Boltzmann samplers for random generation of lambda terms
Randomly generating structured objects is important in testing and optimizing
functional programs, whereas generating random -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
Counting and Generating Terms in the Binary Lambda Calculus (Extended version)
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
Fast Generation of Random Spanning Trees and the Effective Resistance Metric
We present a new algorithm for generating a uniformly random spanning tree in
an undirected graph. Our algorithm samples such a tree in expected
time. This improves over the best previously known bound
of -- that follows from the work of
Kelner and M\k{a}dry [FOCS'09] and of Colbourn et al. [J. Algorithms'96] --
whenever the input graph is sufficiently sparse.
At a high level, our result stems from carefully exploiting the interplay of
random spanning trees, random walks, and the notion of effective resistance, as
well as from devising a way to algorithmically relate these concepts to the
combinatorial structure of the graph. This involves, in particular,
establishing a new connection between the effective resistance metric and the
cut structure of the underlying graph
Enumerating m-Length Walks in Directed Graphs with Constant Delay
In this paper, we provide a novel enumeration algorithm for the set of all
walks of a given length within a directed graph. Our algorithm has worst-case
constant delay between outputting succinct representations of such walks, after
a preprocessing step requiring linear time relative to the size of the graph.
We apply these results to the problem of enumerating succinct representations
of the strings of a given length from a prefix-closed regular language
(languages accepted by a finite automaton which has final states only)
Sampling Random Spanning Trees Faster than Matrix Multiplication
We present an algorithm that, with high probability, generates a random
spanning tree from an edge-weighted undirected graph in
time (The notation hides
factors). The tree is sampled from a distribution
where the probability of each tree is proportional to the product of its edge
weights. This improves upon the previous best algorithm due to Colbourn et al.
that runs in matrix multiplication time, . For the special case of
unweighted graphs, this improves upon the best previously known running time of
for (Colbourn
et al. '96, Kelner-Madry '09, Madry et al. '15).
The effective resistance metric is essential to our algorithm, as in the work
of Madry et al., but we eschew determinant-based and random walk-based
techniques used by previous algorithms. Instead, our algorithm is based on
Gaussian elimination, and the fact that effective resistance is preserved in
the graph resulting from eliminating a subset of vertices (called a Schur
complement). As part of our algorithm, we show how to compute
-approximate effective resistances for a set of vertex pairs via
approximate Schur complements in time,
without using the Johnson-Lindenstrauss lemma which requires time. We
combine this approximation procedure with an error correction procedure for
handing edges where our estimate isn't sufficiently accurate
Efficient generation of elimination trees and graph associahedra
An elimination tree for a connected graph~ is a rooted tree on the vertices of~ obtained by choosing a root~ and recursing on the connected components of~ to produce the subtrees of~.
Elimination trees appear in many guises in computer science and discrete mathematics, and they encode many interesting combinatorial objects, such as bitstrings, permutations and binary trees.
We apply the recent Hartung-Hoang-M\"utze-Williams combinatorial generation framework to elimination trees, and prove that all elimination trees for a chordal graph~ can be generated by tree rotations using a simple greedy algorithm.
This yields a short proof for the existence of Hamilton paths on graph associahedra of chordal graphs.
Graph associahedra are a general class of high-dimensional polytopes introduced by Carr, Devadoss, and Postnikov, whose vertices correspond to elimination trees and whose edges correspond to tree rotations.
As special cases of our results, we recover several classical Gray codes for bitstrings, permutations and binary trees, and we obtain a new Gray code for partial permutations.
Our algorithm for generating all elimination trees for a chordal graph~ can be implemented in time~\cO(m+n) per generated elimination tree, where and~ are the number of edges and vertices of~, respectively.
If is a tree, we improve this to a loopless algorithm running in time~\cO(1) per generated elimination tree.
We also prove that our algorithm produces a Hamilton cycle on the graph associahedron of~, rather than just Hamilton path, if the graph~ is chordal and 2-connected.
Moreover, our algorithm characterizes chordality, i.e., it computes a Hamilton path on the graph associahedron of~ if and only if is chordal