[Nauty] Getting Started with Nauty
Saul Spatz
saul.spatz at gmail.com
Fri Apr 28 11:55:11 AEST 2017
Thanks, Brendan. It looks like I should have been using gentreeg from the
beginning, but it doesn't seem to be mentioned in the User's Guide.
On Thu, Apr 27, 2017 at 8:33 PM, Brendan McKay <Brendan.McKay at anu.edu.au>
wrote:
> Thanks Gordon.
>
> For larger sizes, "gentreeg 10 | linegraphg" will be more efficient.
>
> Saul: The reason your program crashed is that you can't convert
> between the dense and sparse types just by casting the pointer type.
> Casting pointers in C never changes the object which the pointer
> points to.
>
> If you really need to do it inside a program, your choices are:
>
> (1) Write your own procedure to make the linegraph from the
> dense graph structure that geng gives you.
> (2) Use procedure nauty_to_sg, in the file nausparse.c, to convert
> the dense graph to sparse format before calling linegraph().
> (3) Use the OUTPROC feature in gentreeg, see the documentation
> in gentreeg.c. Note that it uses yet another data structure: one
> designed to be as efficient as possible for trees. From that you
> can easily make the linegraph in some form convenient to you.
>
> Method (3) is the best option if you want to push the computation
> as far as possible.
>
> Brendan.
>
> On 28/4/17 11:08 am, Gordon Royle wrote:
>
>> On the command line
>>
>> geng -c 10 9 | linegraphg
>>
>> does your job.
>>
>>
>> On 28 Apr 2017, at 8:25 am, Saul Spatz <saul.spatz at gmail.com<mailto:s
>> aul.spatz at gmail.com>> wrote:
>>
>> I'm a complete newbie. I'm trying to write program that will call geng to
>> generate trees of a given order and compute their line graphs. I modified
>> callgeng.c do construct the trees, and it ran successfully. Since there
>> doesn't seem to be a nauty function to compute the line graphs, I just
>> copied the function linegraph from linegraphg.c. Now my OUTPROC looks
>> like:
>>
>> void OUTPROC(FILE *outfile, graph *g, int n)
>> { /* This will be called for each graph. */
>> ++counter;
>> sparsegraph h;
>> SG_INIT(h);
>> linegraph( (sparsegraph *) g, &h);
>> }
>>
>> When I run the code, I get the error
>>
>> callgeng(30563,0x7fff7d2c9300) malloc: *** mach_vm_map(size=2251799813685
>> 248)
>> failed (error code=3)
>> *** error: can't allocate region
>>
>> Apparently this occurs the first time the line
>> DYNALLOC1(size_t,eno,eno_sz,gnde,"linegraphg");
>> is executed. I have never called SG_INIT for g, because the example shows
>> that OUTPROC takes a parameter of type graph*, so I have just cast the
>> pointer to (sparsegraph*) when calling linegraph.
>>
>> Is this the source of the problem? Is there a built-in way to construct a
>> sparsegraph from a dense graph?
>>
>> Thanks for any assistance you can give me.
>> _______________________________________________
>> Nauty mailing list
>> Nauty at anu.edu.au<mailto:Nauty at anu.edu.au>
>> http://mailman.anu.edu.au/mailman/listinfo/nauty
>>
>> Gordon Royle
>>
>> School of Mathematics and Statistics
>> University of Western Australia
>>
>> Email: gordon.royle at uwa.edu.au<mailto:gordon.royle at uwa.edu.au>
>>
>> (Note: my gordon at maths.uwa.edu.au<mailto:gordon at maths.uwa.edu.au>
>> address is deprecated and will stop working soon.)
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> Nauty mailing list
>> Nauty at anu.edu.au
>> http://mailman.anu.edu.au/mailman/listinfo/nauty
>>
>
>
More information about the Nauty
mailing list