Re: [sage-support] Fwd: Memory

2013-04-22 Thread Tom Boothby
To work around this, I tried storing only sparse6_strings.  The
original code failed (just appending the same graph 100k times), and
the following worked on my machine.  If more list functionality is
necessary, I'd be happy to provide.

There will be some slowdown in creating the graphs extra times, but
depending on what you're doing with them, that might not be a big
concern. (slower working code > fast broken code, IMO)

class glist:
def __init__(self):
self._l = []
def append(self,g):
self._l.append(g.sparse6_string())
def __getitem__(i):
return Graph(self._l[i])

gs = glist()
for i in range(10):

gs.append(Graph([(0,1,0),(0,1,1),(0,1,2),(0,1,3),(2,3,4),(2,3,5),(2,3,6),(4,5,7),(4,5,8),(4,5,9),(0,1,10),(0,1,11),(0,1,12),(0,1,13),(0,1,14)]))



On Mon, Apr 22, 2013 at 7:27 AM, Stefan van Zwam
 wrote:
> Dear all,
>
> Gordon Royle has the following issue. Any ideas?
>
> --Stefan van Zwam.
>
> Begin forwarded message:
>
> Subject: [sage-matroid] Memory
> Date: April 22, 2013 2:24:05 AM EDT
> To: sage-matr...@googlegroups.com
> Reply-To: sage-matr...@googlegroups.com
>
> I'm trying to work with some collections of graphs and matroids, but I can't
> seem to keep the memory usage under control...
>
> For example, I have a test file containing 10 multigraphs that I want to
> import into sage and then process.
>
> gs = []
> gs.append(Graph([(0,1,0),(0,1,1),(0,1,2),(0,1,3),(2,3,4),(2,3,5),(2,3,6),(4,5,7),(4,5,8),(4,5,9),(0,1,10),(0,1,11),(0,1,12),(0,1,13),(0,1,14)]))
> gs.append(Graph([(0,1,0),(0,1,1),(0,1,2),(0,1,3),(2,3,4),(2,3,5),(2,3,6),(4,5,7),(4,5,8),(4,5,9),(0,1,10),(0,1,11),(0,1,12),(0,1,13),(0,2,14)]))
>
> and another 8 lines of the same length.
>
>
> The entire file occupies 14Mb of disk space.
>
> When I run it through sage, the memory usage of the python2.7 process
> fluctuates dramatically from the 140Mb of the just started sage, up to over
> 4Gb before finally settling at 950Mb when the file is fully imported.
>
>
> So somehow, my 14Mb file has blown out to over 800Mb when imported into
> Sage
>
> Given that this file is just a sample for my REAL file which has 4.2 million
> graphs, I just can't see how to proceed.
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "sage-matroid" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-matroid+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-support@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-support?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[sage-support] Fwd: Memory

2013-04-22 Thread Stefan van Zwam
Dear all,

Gordon Royle has the following issue. Any ideas?

--Stefan van Zwam.

Begin forwarded message:

> Subject: [sage-matroid] Memory
> Date: April 22, 2013 2:24:05 AM EDT
> To: sage-matr...@googlegroups.com
> Reply-To: sage-matr...@googlegroups.com
> 
> I'm trying to work with some collections of graphs and matroids, but I can't 
> seem to keep the memory usage under control...
> 
> For example, I have a test file containing 10 multigraphs that I want to 
> import into sage and then process.
> 
> gs = []
> gs.append(Graph([(0,1,0),(0,1,1),(0,1,2),(0,1,3),(2,3,4),(2,3,5),(2,3,6),(4,5,7),(4,5,8),(4,5,9),(0,1,10),(0,1,11),(0,1,12),(0,1,13),(0,1,14)]))
> gs.append(Graph([(0,1,0),(0,1,1),(0,1,2),(0,1,3),(2,3,4),(2,3,5),(2,3,6),(4,5,7),(4,5,8),(4,5,9),(0,1,10),(0,1,11),(0,1,12),(0,1,13),(0,2,14)]))
> 
> and another 8 lines of the same length.
> 
> 
> The entire file occupies 14Mb of disk space.
> 
> When I run it through sage, the memory usage of the python2.7 process 
> fluctuates dramatically from the 140Mb of the just started sage, up to over 
> 4Gb before finally settling at 950Mb when the file is fully imported.
> 
> 
> So somehow, my 14Mb file has blown out to over 800Mb when imported into 
> Sage
> 
> Given that this file is just a sample for my REAL file which has 4.2 million 
> graphs, I just can't see how to proceed.
> 
> -- 
>  
> --- 
> You received this message because you are subscribed to the Google Groups 
> "sage-matroid" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sage-matroid+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.