[Nauty-list] readgraph() (Susanne Nie?)
William Rummler
w.a.rummler at gmail.com
Thu Jan 27 03:16:22 EST 2011
You should be using opengraphfile() and readg() from gtools.h to read
graphs generated by geng. Here is a short example program that
illustrates basic usage.
#define MAXN 30
#include "gtools.h"
int
main( void )
{
/*
* Variables for using with opengraphfile() and readg()
*/
FILE *f;
graph g[ MAXN * MAXM ];
int codetype, m, n;
/*
* Example:
* Reading graphs from standard input and printing their adjacency matrices
*/
set *v;
int i, j;
f = opengraphfile( NULL, &codetype, 0, 0 );
while( readg( f, g, 0, &m, &n ) )
{
for ( i = 0; i < n; ++i )
{
v = GRAPHROW( g, i, m );
for ( j = 0; j < n; ++j )
{
printf( " %d", ISELEMENT( v, j ) ? 1 : 0 );
}
printf( "\n" );
}
printf( "\n" );
}
return 0;
}
More information about the Nauty
mailing list