Directed acyclic graphs (DAGs) are directed graphs in which there is no path
from a vertex to itself. DAGs are an omnipresent data structure in computer
science and the problem of counting the DAGs of given number of vertices and to
sample them uniformly at random has been solved respectively in the 70's and
the 00's. In this paper, we propose to explore a new variation of this model
where DAGs are endowed with an independent ordering of the out-edges of each
vertex, thus allowing to model a wide range of existing data structures. We
provide efficient algorithms for sampling objects of this new class, both with
or without control on the number of edges, and obtain an asymptotic equivalent
of their number. We also show the applicability of our method by providing an
effective algorithm for the random generation of classical labelled DAGs with a
prescribed number of vertices and edges, based on a similar approach. This is
the first known algorithm for sampling labelled DAGs with full control on the
number of edges, and it meets a need in terms of applications, that had already
been acknowledged in the literature.Comment: 32 pages, 12 figures. For the implementation of the algorithms, see
https://github.com/Kerl13/randda