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.
翻译:有向无环图(DAGs)是一类不存在从顶点出发回到自身路径的有向图。DAGs作为计算机科学中普遍存在的数据结构,其顶点数量固定的计数问题与均匀随机采样问题已分别在上世纪70年代和本世纪初得到解决。本文提出对该模型的新变体展开研究:为每个顶点的出边赋予独立序关系,从而能够对更广泛的数据结构进行建模。我们为此类新型结构的采样(包括有/无边数控制两种情形)提供了高效算法,并建立了其数量的渐近等价形式。基于相似方法,我们还提出了一种有效算法用于随机生成顶点与边数均受约束的经典标号DAGs,从而验证了本方法的适用性。该算法是首个能够完全控制边数进行标号DAGs采样的已知方法,有效回应了文献中已明确的实际应用需求。