in reply to Re: storing huge graph
in thread storing huge graph

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 ?

Replies are listed 'Best First'.
Re^3: storing huge graph
by cdarke (Prior) on Aug 08, 2007 at 11:35 UTC
    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.