[Boost.Graph] graph.vertices property creates new objects

G

George Sakkis

I've just started toying with the python bindings of BGL and I'm
puzzled from the following:
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 ?

George
 
S

Szabolcs Nagy

It seems that the vertices iterator creates new vertex objects every
time instead of iterating over the existing ones. This essentially

i don't know much about bgl, but this is possible since vertices are
most likely not stored as python objects inside boost
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 ?

that sounds bad, fortunately __hash__ can be overriden so even if id()
differs hash() can be the same for the same vertex.
if __hash__ is not handled then it's a bug in bgl imho.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top