Boost logo

Boost Users :

Subject: Re: [Boost-users] [BGL] Graph of an Iterator
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2010-05-20 14:38:37


On Thu, 20 May 2010, Hossein Haeri wrote:

> Jeremiah,
>
>>> graph_type gg = graph_of(begin);
>>>
>>> so that gg == g?
>>
>> That's not really possible, just like there is no mapping from STL
>> iterators to their corresponding paper.  In some cases
>
> The situation is not exactly as with STL. In STL, for an iterator i, *i
> will give the element i refers to. (Forgive my technically imprecise
> terminology for a moment please.) Whereas, in BGL, for a vertex_iterator
> vi, *vi will not give the vertex vi refers to; it's g[*vi] that does
> that. So, in fact, my problem will be solved if I can find a way of
> getting holds of the vertex vi is referring to even without messing
> around with g. Any ideas?

In several of the graph types, a vertex descriptor is just an integer, so
there is no graph-specific information in it at all. The vertex that vi
is referring to is *vi; you don't need to have the graph to get the vertex
descriptor out of an iterator. You do need the graph to get properties,
and the vertex descriptor does not have enough information to find them
without the graph being specified separately.

-- Jeremiah Willcock


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