[Nauty-list] How to compile with geng.c?
bdm at cs.anu.edu.au
Sun Mar 25 12:35:21 EST 2007
Hi, I'm appending a sample program that should answer your questions.
* Anjie [Eric] Guo <guo_anjie at hotmail.com> [070325 03:41]:
> When I am trying to compile my main.c with geng.c, how do I know what
> other nauty files should be in my compile command as well?
> Where and how should I define GENG_MAIN so that I can call the
> main(int argc, char *argv) in geng.c as a function from my main.c?
> Eric Guo
/* This is a sample of how to call geng as a procedure rather than
* running it as a separate process. The basic idea is to construct
* an argument list for geng's main() function. At compile time,
* assign a name to the macros OUTPROC and GENG_MAIN. A typical
* Unix-style compilation command would be:
gcc -o callgeng -O3 -DMAXN=32 -DOUTPROC=gengout -DGENG_MAIN=gengmain \
callgeng.c geng.c gtools.o nauty1.o nautil1.o naugraph1.o
static unsigned long counter;
OUTPROC(FILE *outfile, graph *g, int n)
/* This will be called for each graph. */
main(int argc, char *argv)
/* Set up geng argument list. The 0-th argument is the command name.
* There must be a NULL at the end. This example is for connected
* bipartite graphs of order 10 and maximum degree at most 4. */
geng_argv = "geng";
geng_argv = "-q";
geng_argv = "-cb";
geng_argv = "-D4";
geng_argv = "10";
geng_argv = NULL;
geng_argc = 5;
counter = 0;
printf("Number of graphs = %lu.\n",counter);
More information about the Nauty