3

I am interested in listing all the unlabeled1 acyclic digraphs with n vertices which satisfy some additional constraints, such as (a) the resulting graph is connected and (b) except for R identified root vertices, all vertices have two incoming edges and zero or one outgoing edges.

There may also be additional domain-specific constraints, but they are probably easy enough to implement by simply generating and rejecting graphs that do not meet the constraints. In principle, conditions (a) and (b) above could be satisfied in this way above, but at least in the case of (b) it seems very advantageous to consider them directly in generating process since the output is likely to be quite sparse (i.e., a large majority of graphs will fail to satisfy (b) and this ration increases with increasing n).

My problem is twofold:

  1. Even ignoring the constraints part, I have not be able to determine how to efficiently generate DAGs. I know there are a lot of them so I'll mostly be dealing with smallish n, let's say n < 15. There seem to be some promising papers, although may of them are focused on the closed-form counting of the number of graphs rather than actual generation, and any remaining ones are paywalled.

  2. I want to apply the at least enough of the constraint part during the generation to avoid the case where nearly all generated graphs are simply rejected. That is, I hope the generation of the constrained graphs is considerably faster than the generation of the much larger number without constraints.

You can find lots of information on random generation of such graphs, but not much on exhaustive generation (which seems like the easier of the two problems).


1 That is, I want to exclude generation of isomorphic graphs.

D.W.
  • 167,959
  • 22
  • 232
  • 500
BeeOnRope
  • 241
  • 1
  • 8

2 Answers2

4

For small $n$, the easiest solution might be to download a list of all non-isomorphic graphs and then filter them according to your condition.

You might take a look at Brendan McKay's collection, constructed using geng as part of the Nauty graph isomorphism package.

See Enumerate all non-isomorphic graphs of a certain size for more details and citations.

D.W.
  • 167,959
  • 22
  • 232
  • 500
1

You can use nauty to generate all isomorphism classes of undirected graphs, then generate all acyclic orientations of each graph.

An algorithm to generate all acyclic orientations of a given undirected graph can be found here:

http://www.sciencedirect.com/science/article/pii/S0196677497908919

uwt
  • 11
  • 1