1
$\begingroup$

Is there an algorightm generating all digraphs with $n$ edges up to isomorphism whose underlying graph is not a tree? For example, for $n=3$, there are only two such digraphs, representable as $\text{Digraph}({[1,2],[2,3],[3,1]})$ and $\text{Digraph}({[1,2],[2,3],[1,3]})$.

$\endgroup$
2
  • $\begingroup$ Yes. 1) Generate all labeled digraphs whose underlying graph is not a tree. 2) Look for isomorphism, and remove copies. Both these steps can be done in finite time. You probably want to add more details to your question. $\endgroup$ Commented Mar 25, 2019 at 21:43
  • $\begingroup$ @PerAlexandersson Okay I guess that's the best algorithm I can do. There are bruce force algorithms for both generating all digraphs with n edges and identifying the isomorphic digraphs. Thanks! $\endgroup$
    – David Wang
    Commented Mar 25, 2019 at 22:14

1 Answer 1

3
$\begingroup$

There are algorithms that will directly enumerate non-isomorphic graphs, without duplicates, e.g. geng available as a part of nauty and it also have procedures to generate non-isomorphic digraphs with a fixed underlying graph, one is directg (see chapter 15 of nauty manual)

Edit: nauty also have various convenient interfaces, e.g. from Python (SageMath and pynauty)

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .