[Nauty] generate all S-free graphs

Brendan McKay bdm at cs.anu.edu.au
Fri Nov 22 17:02:01 EST 2002


* Sterten at aol.com <Sterten at aol.com> [021122 16:40]:
> Given a set S of graphs of small size,
> I want to generate efficiently all graphs of size n,
> which don't contain any of the graphs from S as induced subgraph.
> 
> I already have a subroutine, which checks whether
> G contains a graph from S.
> The property is hereditary : as soon as there is a forbidden
> subgraph we can immediately backtrack.
> 
> Can I modify geng.c easily or will it be difficult for me ?

geng.c has facilities for this exact application.  It is
explained in the comments at the start of the source code
(look for "PRUNE").  Basically, you write a procedure which
returns 1 if there is a forbidden subgraph and 0 if not.
This is best done in a separate file (don't modify geng.c).
Then compile geng.c with PRUNE defined as the same of your
procedure and of course link in your new file.  That's it.

Brendan.




More information about the Nauty mailing list