# Revision history [back]

About your code. (1) Lists are indexed from 0, so initializing count at 0 would let you access graph number n by typing mylist[n]. (2) No need for semicolons. (3) You can compute the order of the automorphism group without giving it a name. Maybe that's what's making GAP store them.

Below is a rewrite of your code taking these comments into account.

mylist=[]
count = 0
while True:
g = graphs.RandomGNP(6, .5)
mylist.append(g)
if g.automorphism_group().order() > 1:
print "Graph number %s has nontrivial automorphisms!"%(count)
count += 1


If you still experience memory problems, the GAP manual has a section about memory information, telling you how to check how much memory is used.

There is also an FAQ entry telling you how to force garbage collection in GAP.

It says: 2. Garbage collection. The GAP memory manager runs when the system runs out of free memory and can take significant time. To standardise when this happens, run GASMAN("collect") before each test.

Finally, the GAP mailing list archive has this post about garbage collection.

About your code. (1) Lists are indexed from 0, so initializing count at 0 would let you access graph number n by typing mylist[n]. (2) No need for semicolons. (3) You can compute the order of the automorphism group without giving it a name. Maybe that's what's making GAP store them.

Below is a rewrite of your code taking these comments into account.

mylist=[]
count = 0
while True:
g = graphs.RandomGNP(6, .5)
mylist.append(g)
if g.automorphism_group().order() > 1:
print "Graph number %s has nontrivial automorphisms!"%(count)
count += 1


If you still experience memory problems, the GAP manual has a section about memory information, telling you how to check how much memory is used.

There is also an FAQ entry telling you how to force garbage collection in GAP.

It says: 2. Garbage collection. The GAP memory manager runs when the system runs out of free memory and can take significant time. To standardise when this happens, run GASMAN("collect") before each test.

Finally, the GAP mailing list archive has this post about garbage collection.

EDIT: You can add options to the automorphism_group method so that it will return the order and not the group. Maybe that can solve your problem?

mylist=[]
count = 0
while True:
g = graphs.RandomGNP(6, .5)
mylist.append(g)
if g.automorphism_group(order=True,return_group=False) > 1:
print "Graph number %s has nontrivial automorphisms!"%(count)
count += 1