[Nauty] Error using nauty with more than 32 vertices?

Brendan McKay bdm at cs.anu.edu.au
Tue Apr 13 16:15:01 EST 2004


* Nick Penwarden <penwan at rpi.edu> [040413 15:59]:
> I'm calling nauty in my program to determine if two graphs are 
> isomorphic. I am doing so by calling nauty once for each graph to get 
> the canonical sum of the graphs and then comparing them with the 
> testcanlab function. This works perfectly on graphs with <= 32 vertices, 
> but does not work properly for graphs with > 32 vertices. Sometimes it 
> segfaults and sometimes it just returns that the graphs are not 
> isomorphic when they in fact are.
> 
> I have defined MAXN as 64, and am passing n and m correctly to both 
> nauty and testcanlab. Any ideas?

I'm guessing that you have an array overflow, but it could be other
things.  Did you declare the graph variables to have at least m*n words?

Incidentally, you don't need the testcanlab function.  The canonical
graphs can be compared directly using ordinary comparisons:

  nauty(g1,lab,ptn, ..., m,n, canon1);
  nauty(g2,lab,ptn, ..., m,n, canon2);
  for (i = 0; i < m*n; ++i)
      if (canon1[i] != canon2[i]) break;
  if (i < m*n) { NOT ISOMORPHIC } else { ISOMORPHIC }

You could also use  memcmp(canon1,canon2,m*n*sizeof(graph));

Brendan.




More information about the Nauty mailing list