|
Boost Users : |
From: George Sakkis (george.sakkis_at_[hidden])
Date: 2007-01-29 20:33:37
Doug,
thanks for the prompt reply. Do you happen to have Windows binaries in
SVN too ?
By the way, I was trying to get my head around "property maps" and the
whole time I was thinking how redundant would all this boilerplate be
in pure Python. Perhaps I'm still missing the point, but why not allow
subclassing Vertices and Edges and store all (internal) properties as
attributes in the same object instead of dealing with property maps ?
I understand that this might be the way to go in a statically typed
B&D language but is there an advantage of using property maps in a
language like Python ? If not, I might end up writing a more pythonic
wrapper around the BGL binding; do you have any insights on how this
may work out?
Thanks,
George
On 1/29/07, Doug Gregor <dgregor_at_[hidden]> wrote:
>
> On Jan 29, 2007, at 12:52 AM, George Sakkis wrote:
>
> > I've just started playing with the python bindings of BGL and I'm
> > puzzled from the following:
> >
> >>>> from boost.graph import Graph
> >>>> g = Graph()
> >>>> v = g.add_vertex()
> >>>> g.vertices.next() == v
> > True
> >>>> g.vertices.next() is v
> > False
> >
> > It seems that the vertices iterator creates new vertex objects every
> > time instead of iterating over the existing ones. This essentially
> > prevents, among other things, storing vertices as keys in a dictionary
> > since the hashes of the stored and the new vertex differ although they
> > compare equal. Is this really what's happening, and if so, why ?
>
> The latest version of the BGL-Python bindings, available in the
> Subversion repository, re-uses vertex and edge descriptors, so the
> last check would return "True". This is what we should have been
> doing all along.
>
> Cheers,
> Doug
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net