On 2008-10-28 01:32, Carl Banks wrote: > I was wondering if anyone had any advice on this. > > This is not to study graph theory; I'm using the graph to represent a > problem domain. The graphs could be arbitrarily large, and could > easily have millions of nodes, and most nodes have a substantial > amount of data associated with them. Obviously I don't want a whole > such graph in memory at once, so libraries the just deal with in- > memory graphs are out. > > I know I could implement this with a relational DB, and I'd be fine > with a library that was built on top of one. But I'm hoping for > specialzed behavior useful for graphs. > > For example, suppose I have a set of nodes called A. It would be > useful to know if any of these nodes are connected by paths that > include no nodes in A. I could, of course, do that by reading from > the database and following the paths, but I clearly don't want to do > that. I would want instead to somehow cache the outside connectedness > relationship between different nodes of A. But then what happens if > something changes elsewhere. How is the cache for A notified, and can > it be updated efficiently using graph theorems, rather than > regenerated? > > It's very tricky; that's why I hope someone else has done it. > > I'm guessing no.
Aaron Watters is an expert on this and has implemented kjbuckets for doing this in memory: http://gadfly.sourceforge.net/kjbuckets.html Gadfly uses the library to implement relational queries (and works on disk): http://gadfly.sourceforge.net/ The package is now maintained by Richard Jones. You might be able to reuse some parts of Gadfly for your purposes. Also have a look at Pygr: http://bioinfo.mbi.ucla.edu/pygr which is a Python library to build a graph interface on top of a relational database. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Oct 28 2008) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 -- http://mail.python.org/mailman/listinfo/python-list