Boost logo

Boost :

Subject: Re: [boost] How to construct a reverse_edge_map from CSR
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2010-04-16 14:06:51


On Fri, 16 Apr 2010, Dan Jiang wrote:

>
> Hi All,
> I am having difficulty in constructing a reverse_edge_map from an existing CSR. My CSR was created as "edges_are_unsorted", I need to create a reverse_edge_map out of it?
> Here is my attempt:1 BGL_FORALL_EDGES(e, g, BOOST_Graph)2 {3 // Get source and target of the edge4 BOOST_Graph::vertex_descriptor src = boost::source(e, g);5 BOOST_Graph::vertex_descriptor dst = boost::target(e, g);678 // Get reverse edge9 graph_traits<BOOST_Graph>::out_edge_iterator ei, ei_end;10 for (tie(ei, ei_end) = edge_range(dst, src, g); ei != ei_end; ++ei) 11 {12 rev[*e] = *ei;13 break; // I know there is only one reverse edge in my graph14 } 15 }
> I got compile error on line 10:
> error C2784: 'std::pair<Config::out_edge_iterator,Config::out_edge_iterator> boost::edge_range(Config::vertex_descriptor,Config::vertex_descriptor,const boost::adj_list_helper<Config,Base> &)' : could not deduce template argument for 'const boost::adj_list_helper<Config,Base> &' from 'BOOST_Graph'
> where BOOST_Graph is a CSR graph that has been instantiated as "edges_are_unsorted" prior to the loop.
> Any help is appreciated.
> -Thanks,
> Dan

Could you please reformat your code to be more readable? What is the
exact type of your graph, and what are the definitions of the vertex and
edge bundled property classes?

-- Jeremiah Willcock


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk