[Nauty-list] readgraph()

William Rummler w.a.rummler at gmail.com
Wed Feb 2 08:49:15 EST 2011

2011/2/1 Susanne Nieß <niess at ma.tum.de>:
> Thank you for your help; unfortunately it did not solve the problem. With
> readg, the program still complains about an illegal character.

If readg() is reporting an illegal character, then I think your input
must have been otherwise modified since you produced it with geng,
because readg() will only report an illegal character when it reads a
line containing a character besides ':' (the prefix for sparse6
format) and outside of the ASCII range '?' through '~' (decimal 63
through 126).

Is it possible that your input contains lines with "header"
information (or comments and written text) of some sort? That could
explain it.

> Now I have an even more severe problem: I get a segmentation fault,
> seemingly when I use nauty. I wrote a function that takes the upper triangle
> of the adjacency matrix of a graph and writes the graph in the format that
> nauty uses (I need such a function and could not find any) and in my test
> program I call this function and than nauty and the result is a segmenation
> fault. As I am not able to read a graph with a function from the
> nauty-package, I can not say if my format-changing function causes the
> problem.

The gtools function ntog6() will convert a graph datatype to a C
string containing that graph's graph6 representation. The gtools
function writeg6() uses ntog6() to output a graph's graph6
representation to a given stream. There are similar and
similarly-named functions for sparse graphs.

> My function is:

If the above comments don't help, then I think it would be
considerably easier to help you debug your program's segfault if you
gave the input (and the minimum compilable source) necessary to
reproduce it. Otherwise, the process can be unnecessarily inefficient.



> On 01/26/11 05:16 PM, William Rummler wrote:
>> 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.

More information about the Nauty mailing list