[prev in list] [next in list] [prev in thread] [next in thread]
List: boost-users
Subject: Re: [Boost-users] [graph] [python]
From: David Abrahams <dave () boost-consulting ! com>
Date: 2006-02-28 13:59:50
Message-ID: uek1n37op.fsf () boost-consulting ! com
[Download RAW message or body]
Doug Gregor <dgregor@cs.indiana.edu> writes:
> On Feb 27, 2006, at 2:33 PM, David E. Konerding wrote:
>> Here's what I see:
>> new v1= <boost.graph._graph.Vertex object at 0x40168a04>
>> new v2= <boost.graph._graph.Vertex object at 0x40168aac>
>> new edge= <boost.graph._graph.Edge object at 0x40164dec>
>> vertex: <boost.graph._graph.Vertex object at 0x40168ae4>
>> vertex: <boost.graph._graph.Vertex object at 0x40168b54>
>> edge: <boost.graph._graph.Edge object at 0x40164d6c>
>> edge source: <boost.graph._graph.Vertex object at 0x40168ae4>
>>
>> As you can see, v1 and v2 return and have different addresses than the
>> Vertex objects that are listed by the vertices
>> iterator. My guess here is that the Vertex objects do point to the
>> same
>> underlying vertex in the C++ implementation
>> of the graph.
>
> Your guess is correct. We don't cache the Python objects corresponding
> to vertex and edge descriptors.
You probably don't want to pay this cost, but you might be able to
make the behavior more predictable if you used shared_ptrs inside the
C++ graph representation, since they will automatically retain the
identity of the Python object wrappers.
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic