Boost logo

Boost Users :

From: Doug Gregor (dgregor_at_[hidden])
Date: 2007-01-29 15:15:37


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 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