[Numpy-discussion] Graph class

David Grant davidgrant at gmail.com
Tue Aug 1 15:36:16 CDT 2006


I actually just looked into the boost graph library and hit a wall. I
basically had trouble running bjam on it. It complained about a missing
build file or something like that.

Anyways, for now I can live with non-sparse implementation. This is mostly
prototyping code for integeration in to a largely Java system (with some
things written in C). So this will be ported to Java or C eventually.
Whether or not I will need to protoype something that scales to thousands of
nodes remains to be seen.

Dave

On 8/1/06, Charles R Harris <charlesr.harris at gmail.com> wrote:
>
> Hi David,
>
> I often have several thousand nodes in a graph, sometimes clustered into
> connected components. I suspect that using an adjacency matrix is an
> inefficient representation for graphs of that size while for smaller graphs
> the overhead of more complicated structures wouldn't be noticeable. Have you
> looked at the boost graph library? I don't like all their stuff but it is a
> good start with lots of code and a suitable license.
>
> Chuck
>
> On 8/1/06, David Grant <davidgrant at gmail.com> wrote:
>
> > I have written my own graph class, it doesn't really do much, just has a
> few methods, it might do more later. Up until now it has just had one piece
> of data, an adjacency matrix, so it looks something like this:
>
> class Graph:
>     def __init__(self, Adj):
>         self.Adj = Adj
>
> I had the idea of changing Graph to inherit numpy.ndarray instead, so then
> I can just access itself directly rather than having to type self.Adj. Is
> this the right way to go about it? To inherit from numpy.ndarray?
>
> The reason I'm using a numpy array to store the graph by the way is the
> following:
> -Memory is not a concern (yet) so I don't need to use a sparse structure
> like a sparse array or a dictionary
> -I run a lot of sums on it, argmin, blanking out of certain rows and
> columns using fancy indexing, grabbing subgraphs using vector indexing
>
> --
> David Grant
> http://www.davidgrant.ca
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>
>
>
>


-- 
David Grant
http://www.davidgrant.ca
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20060801/f42e1b46/attachment.html 


More information about the Numpy-discussion mailing list