Boost logo

Boost Users :

Subject: Re: [Boost-users] [BGL] inv_adjacency_iterator is missing in graph_traits.hpp
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2012-07-26 17:25:33


On Mon, 23 Jul 2012, Johan Oudinet wrote:

> Hi again,
>
> On Mon, Jul 23, 2012 at 6:15 PM, Johan Oudinet <johan.oudinet_at_[hidden]> wrote:
>> Hi,
>>
>> I have a bidirectional adjacency list and I want to use the
>> inv_adjacent_vertices method
>> However, the following code does not compile:
>> typedef boost::graph_traits<Graph> Traits;
>> typedef typename Traits::inv_adjacency_iterator inv_adjacency_iterator;
>> inv_adjacency_iterator w, w_end;
>> boost::tie (w, w_end) = inv_adjacent_vertices (v, g_);
>>
>> The problem is that inv_adjacency_iterator is not part of
>> boost::graph_traits :-(
>>
>> Could you tell me how can I use the inv_adjacent_vertices method
>> (i.e., how can I declare an inv_adjacent_iterator)?
>
> Obviously, I found a workaround 2 minutes after sending this email...
> which consist in using the inv_adjacency_iterator_generator:
> typedef typename boost::inv_adjacency_iterator_generator<Graph,
> vertex_descriptor, in_edge_iterator>::type inv_adjacency_iterator;
>
> Hope this will help someone else. Anyway, I would like to know why
> this type can't be also part of boost::graph_traits?

It looks like (according to
http://www.boost.org/doc/libs/1_50_0/libs/graph/doc/adjacency_list.html)
you should be using <your graph type>::inv_adjacency_iterator. It is
probably not in graph_traits because there is no concept that uses it.

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