in reply to storing huge graph

I'm not so sure that you necessarily will have a memory problem - the 600 bytes payload for your 172800 nodes amounts to 104MB. If we (generously) double that amount to estimate the memory Perl will need per node, that brings us to roughly 200MB. Depending on how interconnected your graph will be, you'll have to estimate the number of edges, but with 2GB of RAM you will have plenty of memory to go by ...

Replies are listed 'Best First'.
Re^2: storing huge graph
by spx2 (Deacon) on Aug 08, 2007 at 09:58 UTC

    i was also hoping on a method to store them on disk...

    i thought of something but it's quite amateurish. like store nodes 1-1000 in a file called 1-1000.txt then store 1000-2000 in a file 1000-2000.txt etc and then when i need a certain node i load up that file into memory containing the nodes needed. altough i think that this may mean is should implement all the graph class. is there an efficient way to store them on disk ?

      It depends on what you mean by 'efficient': small or fast.
      TMTOWTDI: generally speaking the most efficent size to be loaded on any (virtual memory) system is a page, but... The size of a page varies between systems, on 32-bit Intel the page-size (Windoze or Linux) is 4kb. The paging manager in the Operating System loads code and data pages from the page (or swap) file. You can take advantage of this by using a memory mapped file (File Mapping, or Section, Objects on Windows), and on-demand page loading, which most OS's support.
      Using memory mapping (see IPC::Mmap on CPAN) you should then be able to store the whole lot in one huge file, but the underlying system should only load the pages needed as required.