Hi Jeremiah,
I tried putting the reverse_graph into a variable and then calling
dijkstra with a weightma of the reversed graph as you suggested,
but that results in a different error. I am having trouble
understanding the error message I am getting from the compiler,
could you please help me understand, what I am doing wrong?
Here is the supplementary code:
typedef reverse_graph<mcf_graph> reverse_graph_t;
reverse_graph_t rg = reverse_graph_t(g);
dijkstra_shortest_paths (rg, before_p, predecessor_map ( &p[0]
).distance_map ( &d[0] ).weight_map ( get (
&Edge::m_weight, rg) ).vertex_index_map ( get ( vertex_index,
rg) ) );
And the error message
/usr/include/boost/graph/reverse_graph.hpp: In instantiation of
‘typename boost::disable_if<boost::is_same<Property,
boost::edge_underlying_t>, typename
boost::property_map<boost::reverse_graph<BidirectionalGraph,
GraphRef>, Property>::type>::type boost::get(Property,
boost::reverse_graph<BidirectionalGraph, GraphRef>&)
[with BidirGraph = boost::adjacency_list<boost::vecS,
boost::vecS, boost::bidirectionalS, Port, Edge>; GRef = const
boost::adjacency_list<boost::vecS, boost::vecS,
boost::bidirectionalS, Port, Edge>&; Property = double
Edge::*; typename boost::disable_if<boost::is_same<Property,
boost::edge_underlying_t>, typename
boost::property_map<boost::reverse_graph<BidirectionalGraph,
GraphRef>, Property>::type>::type =
boost::detail::reverse_graph_edge_property_map<boost::adj_list_edge_property_map<boost::bidirectional_tag,
double, double&, long unsigned int, Edge, double Edge::*>
>]’:
/home/berit/git/lsndp/src/ipheuristic.cpp:959:128: required from
here
/usr/include/boost/graph/reverse_graph.hpp:387:93: error: no
matching function for call to
‘boost::detail::reverse_graph_edge_property_map<boost::adj_list_edge_property_map<boost::bidirectional_tag,
double, double&, long unsigned int, Edge, double Edge::*>
>::reverse_graph_edge_property_map(boost::detail::adj_list_any_edge_pmap::bind_<boost::adjacency_list<boost::vecS,
boost::vecS, boost::bidirectionalS, Port, Edge>, Edge, double
Edge::*>::const_type)’
return typename
property_map<reverse_graph<BidirGraph,GRef>,
Property>::type(get(p, g.m_g));
^
/usr/include/boost/graph/reverse_graph.hpp:387:93: note:
candidates are:
/usr/include/boost/graph/reverse_graph.hpp:342:14: note:
boost::detail::reverse_graph_edge_property_map<PM>::reverse_graph_edge_property_map(const
PM&) [with PM =
boost::adj_list_edge_property_map<boost::bidirectional_tag,
double, double&, long unsigned int, Edge, double Edge::*>]
explicit reverse_graph_edge_property_map(const PM& pm):
underlying_pm(pm) {}
^
/usr/include/boost/graph/reverse_graph.hpp:342:14: note: no
known conversion for argument 1 from
‘boost::detail::adj_list_any_edge_pmap::bind_<boost::adjacency_list<boost::vecS,
boost::vecS, boost::bidirectionalS, Port, Edge>, Edge, double
Edge::*>::const_type {aka
boost::adj_list_edge_property_map<boost::bidirectional_tag,
double, const double&, long unsigned int, const Edge, double
Edge::*>}’ to ‘const
boost::adj_list_edge_property_map<boost::bidirectional_tag,
double, double&, long unsigned int, Edge, double
Edge::*>&’
/usr/include/boost/graph/reverse_graph.hpp:332:10: note:
boost::detail::reverse_graph_edge_property_map<boost::adj_list_edge_property_map<boost::bidirectional_tag,
double, double&, long unsigned int, Edge, double Edge::*>
>::reverse_graph_edge_property_map(const
boost::detail::reverse_graph_edge_property_map<boost::adj_list_edge_property_map<boost::bidirectional_tag,
double, double&, long unsigned int, Edge, double Edge::*>
>&)
struct reverse_graph_edge_property_map {
^
/usr/include/boost/graph/reverse_graph.hpp:332:10: note: no
known conversion for argument 1 from
‘boost::detail::adj_list_any_edge_pmap::bind_<boost::adjacency_list<boost::vecS,
boost::vecS, boost::bidirectionalS, Port, Edge>, Edge, double
Edge::*>::const_type {aka
boost::adj_list_edge_property_map<boost::bidirectional_tag,
double, const double&, long unsigned int, const Edge, double
Edge::*>}’ to ‘const
boost::detail::reverse_graph_edge_property_map<boost::adj_list_edge_property_map<boost::bidirectional_tag,
double, double&, long unsigned int, Edge, double Edge::*>
>&’
Thank you very much in advance.
Best Regards,
|
Please
read about the ENERPLAN project
here
|
|
|
On 04/16/2013 08:13 PM, Jeremiah Willcock wrote:
On Tue, 16 Apr 2013, Berit Dangaard Brouer wrote:
Hi,
First of all thank you for providign the boost BGL library. I use it
extensively.
I am having some problems with some code, that works just fine using boost
version 1.46, but cannot compile using version 1.48 and higher.
I have a Bidirectional Graph using bundled properties defined as:
struct Port
{
Port(int index=-1, int type=-1, int port_code=0, string UN="NN", string
name="NN", int service_id=-1 ): m_index(index), m_type(type), m_port_code(
port_code), UNLOCODE(UN), m_name(name), m_service_id(service_id) {}
int m_index;
int m_type;//0 port, 1 port call
int m_port_code;
string UNLOCODE;
string m_name;
int m_service_id;
};
struct Edge
{
Edge( int id=-1, int type=-1, double weight=0.0, double cost=0.0, double
dual_cost=0.0, double util=0.0, double cap=0.0, double r_cap=0.0 ) :
m_idx(id), m_type(type), m_weight(weight) , m_cost(cost),
m_dual_cost(dual_cost), m_utilization(util), m_capacity(cap),
m_res_cap(r_cap) {}
unsigned int m_idx;
int m_type;//0 is load edge, 1 is voyage edge, 2 forfeited edge
(commodity link)
double m_weight; //distance
double m_cost; //cost - only on load/unload/transhipment edges
double m_dual_cost;
double m_utilization;
double m_capacity;
double m_res_cap; //residual capacity
};
//Graph
typedef adjacency_list<
vecS ,
vecS ,
bidirectionalS,
Port,
Edge>
mcf_graph;
I am trying to make a call to dijkstra on a reversed graph as follows: (the
reversed graph is also a filtered graph, but I do not think this is an issue:
dijkstra_shortest_paths (make_reverse_graph(fg), before_p, predecessor_map (
&p[0] ).distance_map ( &d[0] ).weight_map ( get ( &Edge::m_weight, fg)
).vertex_index_map ( get ( vertex_index,fg ) ) );
The problem here is that you pass in a weight map from the original
graph while the algorithm expects one on the reverse graph. That used
to work, but some of the internals of reverse_graph have changed so that
it doesn't anymore. Try putting the reverse_graph into a variable and
then calling get(&Edge::m_weight, rg) on that. You probably want to do
the same for vertex_index_map, but that is less important (reverse_graph
does not change the graph vertex type).
-- Jeremiah Willcock
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users