Boost logo

Boost Users :

From: Jeffrey Holle (jeff.holle_at_[hidden])
Date: 2004-11-29 13:14:59


Be aware that the vertex which a vertex descriptor references to can
change as vertices are removed from the graph. Its just a vector index
after all...

Sebastian Weber wrote:
> Hi Jeremy!
>
>> Why do you want to store vertex iterators instead of just vertex
>> descriptors?
>
>
> Maybe this is what I want to store :-)
>
> I want to store something which points to a vertex which allows me the
> fastest possible access to the vertex with all it's internal properties
> connected to it. If a reference to a vertex descriptor does that, this
> is what I want. I guess I gotta read a little more the docs
>
>>
>> You can use adjacency_list_traits to get the vertex_descriptor type
>> prior to creating the graph type.
>
>
> Doug already pointed that out. Once again I gotta read a little more
> documentation ...
>
> Thanks although!
>
> Greetings,
>
> Sebastian
>
>>
>> Cheers,
>> Jeremy
>>
>>
>> On Nov 29, 2004, at 7:14 AM, Vladimir Prus wrote:
>>
>>> Hi Sebastian,
>>>
>>>> Hi folks!
>>>>
>>>> I got a cyclic type-dependency problem. I am trying to let every vertex
>>>> store a iterator to a list which stores vertex-iterators. This sounds
>>>> weired, but I need to keep track of very few vertices within my graph
>>>> which have a particle located at it. Thus I created a list of
>>>> vertex-iterators who carry my particle positions in the graph. In order
>>>> to be able to tell quickly if a vertice is taken by a particle I want
>>>> each vertice to include a pointer to a null element representing the
>>>> absence of a particle or a pointer into that list. My non-working code
>>>> looks like:
>>>>
>>>> Definition of my graph:
>>>>
>>>> struct Spot {
>>>> // acutally I need the vertex_iterator to be defined already
>>>> // in order to define particle, but this is not yet defined
>>>> // so I am using the knowledge that it is going to be represented
>>>> // by a vector<std::size_t>::iterator (at least I hope so)
>>>> // this assumption is WRONG!!
>>>> typedef std::list< std::vector<std::size_t>::iterator >::iterator \\
>>>
>>>
>>>
>>> There are two approaches.
>>>
>>> 1. Use pimpl or incomplete type to postpone defining the property
>>> type until
>>> you know the iterator type.
>>>
>>> struct Spot;
>>> typedef boost::adjacency_list<boost::vecS, boost::vecS, \\
>>> boost::undirectedS, Spot* > graph_t;
>>>
>>> struct Spot { ............. } ;
>>>
>>> 2. Don't bother with iterators, store vector<unsigned> inside the Spot
>>> class. For VecS/VecS graph, using unsigned to identify vertices
>>> should be
>>> OK.
>>>
>>> BTW, I'm not sure why your code does not work. It should work, maybe
>>> after
>>> changing size_t to int -- don't remember if vertex_descrption is
>>> signed or
>>> not.
>>>
>>> - Volodya
>>>
>>>
>>> _______________________________________________
>>> Boost-users mailing list
>>> Boost-users_at_[hidden]
>>> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>>>
>> _______________________________________________
>> Jeremy Siek <jsiek_at_[hidden]>
>> http://www.osl.iu.edu/~jsiek
>> Ph.D. Student, Indiana University Bloomington
>> C++ Booster (http://www.boost.org)
>> _______________________________________________
>>
>> _______________________________________________
>> 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