Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Using nauty_geng with variable number of vertices

I am trying to use the nauty graph generator to count the number of non-isomorphic graphs with specified properties, but I am hindered by the fact that it seems nauty_geng only allows a fixed number of vertices.

For example, the following code counts the number of (non-isomorphic) connected graphs on 5 vertices:

count = 0
for g in graphs.nauty_geng("5 -c"):
     count += 1
print count

The Sage output is: 21.

However, if I try to count the number of connected graphs on n vertices for n in a certain range, say n=3,4,5,6, as with the following code,

for n in range(3,7):
     count = 0
     for g in graphs.nauty_geng("n -c"):
         count += 1
     print (n,count)

,the count remains equal to zero for each n, and the situation is the same for all similar codes I have tried. The result is that in order to see what happens for multiple values of n, I must manually change all occurrences of n in the code.

  1. Is this the meaning of "At a minimum, you must pass the number of vertices you desire," a statement in the help box?

  2. Is there any way around this?

Thanks for any help with this!

click to hide/show revision 2
retagged

Using nauty_geng with variable number of vertices

I am trying to use the nauty graph generator to count the number of non-isomorphic graphs with specified properties, but I am hindered by the fact that it seems nauty_geng only allows a fixed number of vertices.

For example, the following code counts the number of (non-isomorphic) connected graphs on 5 vertices:

count = 0
for g in graphs.nauty_geng("5 -c"):
     count += 1
print count

The Sage output is: 21.

However, if I try to count the number of connected graphs on n vertices for n in a certain range, say n=3,4,5,6, as with the following code,

for n in range(3,7):
     count = 0
     for g in graphs.nauty_geng("n -c"):
         count += 1
     print (n,count)

,the count remains equal to zero for each n, and the situation is the same for all similar codes I have tried. The result is that in order to see what happens for multiple values of n, I must manually change all occurrences of n in the code.

  1. Is this the meaning of "At a minimum, you must pass the number of vertices you desire," a statement in the help box?

  2. Is there any way around this?

Thanks for any help with this!

click to hide/show revision 3
retagged

Using nauty_geng with variable number of vertices

I am trying to use the nauty graph generator to count the number of non-isomorphic graphs with specified properties, but I am hindered by the fact that it seems nauty_geng only allows a fixed number of vertices.

For example, the following code counts the number of (non-isomorphic) connected graphs on 5 vertices:

count = 0
for g in graphs.nauty_geng("5 -c"):
     count += 1
print count

The Sage output is: 21.

However, if I try to count the number of connected graphs on n vertices for n in a certain range, say n=3,4,5,6, as with the following code,

for n in range(3,7):
     count = 0
     for g in graphs.nauty_geng("n -c"):
         count += 1
     print (n,count)

,the count remains equal to zero for each n, and the situation is the same for all similar codes I have tried. The result is that in order to see what happens for multiple values of n, I must manually change all occurrences of n in the code.

  1. Is this the meaning of "At a minimum, you must pass the number of vertices you desire," a statement in the help box?

  2. Is there any way around this?

Thanks for any help with this!