Interesting. Is this a good way to do it? Is the other way to precompute the edges, and then use these as an edgeDB? I guess I'm unsure of what the edgeDB should contain - what should the id's and/or keys be? So when I ask for G[src][target], what is looked up in the edgeDB to get the information needed? Thanks for the help so far.
Kenny On Jul 22, 8:50 pm, Christopher Lee <[email protected]> wrote: > Hi Kenny, > Graph expects to store source, target and edge as IDs, whereas you > want edge to be saved as itself (instead of as its ID). That's why > you're getting the "int object has no 'id' attribute" error (when it > tries to extract an ID from your edge object). > > You can subclass Graph to give the behavior you want, by overriding > its pack_edge() and unpack_edge() methods to be trivial: > > class MyGraph(Graph): > def pack_edge(self, edge): > return edge > def unpack_edge(self, edge): > return edge > > Also, mode='memory' is not valid for Graph. By default, it uses an in- > memory dict; only if you give it a filename argument will it use a > shelve as the storage. So just get rid of the mode='memory' argument. > > Hope that helps! > > -- Chris --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pygr-dev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/pygr-dev?hl=en -~----------~----~----~----~------~----~------~--~---
