Problems calling make_reversed_graph in a call to dijkstra from version 1.48

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 ) ) ); which works fine in 1.46, but it seems in 1.48 I can no longer use make_reverse_graph(<mcf_graph&>) (returning a reverse graph) with the bundled properties from fg. and I get the error (compressed summary - full details attached) usr/include/boost/property_map/property_map.hpp:354:56: error: no match for 'operator[]' in '((const boost::bundle_property_map<boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS, Port, Edge>, boost::detail::edge_desc_impl<boost::bidirectional_tag, long unsigned int>, Edge, double>&)pa)[k]' /usr/include/boost/property_map/property_map.hpp:354:56: note: candidate is: In file included from /usr/include/boost/graph/adjacency_list.hpp:44:0, from /home/chrkr/git/lsndp/include/ipheuristic.h:36, from /home/chrkr/git/lsndp/src/ipheuristic.cpp:29: /usr/include/boost/graph/properties.hpp:399:15: note: T& boost::bundle_property_map<Graph, Descriptor, Bundle, T>::operator[](boost::bundle_property_map<Graph, Descriptor, Bundle, T>::key_type) const [with Graph = boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS, Port, Edge>; Descriptor = boost::detail::edge_desc_impl<boost::bidirectional_tag, long unsigned int>; Bundle = Edge; T = double; boost::bundle_property_map<Graph, Descriptor, Bundle, T>::reference = double&; boost::bundle_property_map<Graph, Descriptor, Bundle, T>::key_type = boost::detail::edge_desc_impl<boost::bidirectional_tag, long unsigned int>] /usr/include/boost/graph/properties.hpp:399:15: note: no known conversion for argument 1 from 'const boost::detail::reverse_graph_edge_descriptor<boost::detail::edge_desc_impl<boost::bidirectional_tag, long unsigned int> >' to 'boost::bundle_property_map<boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS, Port, Edge>, boost::detail::edge_desc_impl<boost::bidirectional_tag, long unsigned int>, Edge, double>::key_type {aka boost::detail::edge_desc_impl<boost::bidirectional_tag, long unsigned int>}' From various sources I understand that as of 1.48 reverse graph is no longer an image of the graph, but another object, where I need the actual property maps and the property maps of the reversed graph, but I did not get much wiser on how to call dijkstra with the reversed graph given these new description. I tried defining the reverse graph as a separate object reverse_graph<mcf_graph> r_fg=reverse_graph(fg); dijkstra_shortest_paths (r_fg), before_p, predecessor_map ( &p[0] ).distance_map ( &d[0] ).weight_map ( get ( &Edge::m_weight, r_fg) ).vertex_index_map ( get ( vertex_index, r_fg ) ) ); indicating that I am not getting the right properties for the reverse graph: equired from here /usr/include/boost/graph/properties.hpp:420:44: error: no type named 'vertex_bundled' in 'class boost::reverse_graph<boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS, Port, Edge> >' /usr/include/boost/graph/properties.hpp:421:42: error: no type named 'edge_bundled' in 'class boost::reverse_graph<boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS, Port, Edge> >' /usr/include/boost/graph/properties.hpp:425:7: error: no type named 'vertex_bundled' in 'class boost::reverse_graph<boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS, Port, Edge> >' /usr/include/boost/graph/properties.hpp:429:7: error: no type named 'vertex_bundled' in 'class boost::reverse_graph<boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS, Port, Edge> >' /usr/include/boost/graph/properties.hpp:432:70: error: no type named 'vertex_bundled' in 'class boost::reverse_graph<boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS, Port, Edge> >' /usr/include/boost/graph/properties.hpp:434:7: error: no type named 'vertex_bundled' in 'class boost::reverse_graph<boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS, Port, Edge> >' /home/chrkr/git/lsndp/src/ipheuristic.cpp:939:132: error: no matching function for call to 'get(double Edge::*, boost::reverse_graph<boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS, Port, Edge> >&)' /home/chrkr/git/lsndp/src/ipheuristic.cpp:939:132: note: candidates are: In file included from /usr/include/boost/graph/adjacency_list.hpp:36:0, from /home/chrkr/git/lsndp/include/ipheuristic.h:36, from /home/chrkr/git/lsndp/src/ipheuristic.cpp:29: /usr/include/boost/property_map/property_map.hpp:179:19: note: template<class T> const T& get(const T*, std::ptrdiff_t) /usr/include/boost/property_map/property_map.hpp:179:19: note: template argument deduction/substitution failed: /home/chrkr/git/lsndp/src/ipheuristic.cpp:939:132: note: mismatched types 'const T*' and 'double Edge::*' In file included from /usr/include/boost/graph/graphviz.hpp:25:0, from /home/chrkr/git/lsndp/include/data.h:19, from /home/chrkr/git/lsndp/include/ipheuristic.h:46, from /home/chrkr/git/lsndp/src/ipheuristic.cpp:29: /usr/include/boost/property_map/dynamic_property_map.hpp:322:1: note: template<class Key> std::string boost::get(const string&, const boost::dynamic_properties&, const Key&) /usr/include/boost/property_map/dynamic_property_map.hpp:322:1: note: template argument deduction/substitution failed: Is the problem the bundled properties from the original graph or ? -- Best Regards, Ph.D. Berit Dangaard Brouer Post Doc. DTU Management Engineering, Management Science Technical University of Denmark Department of Management Engineering Produktionstorvet, Bygning 426 2800 Kgs. Lyngby blof@dtu.dk <mailto:blof@man.dtu.dk> www.ms.man.dtu.dk <http://www.ms.man.dtu.dk> http://www.maersk.com/innovation/leadingthroughinnovation/enerplan/ Please read about the ENERPLAN project here <http://www.maersk.com/innovation/leadingthroughinnovation/enerplan/>

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

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, Ph.D. Berit Dangaard Brouer Post Doc. DTU Management Engineering, Management Science Technical University of Denmark Department of Management Engineering Produktionstorvet, Bygning 426 2800 Kgs. Lyngby blof@dtu.dk <mailto:blof@man.dtu.dk> www.ms.man.dtu.dk <http://www.ms.man.dtu.dk> http://www.maersk.com/innovation/leadingthroughinnovation/enerplan/ Please read about the ENERPLAN project here <http://www.maersk.com/innovation/leadingthroughinnovation/enerplan/> 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

Hi, With a little help from a good colleague, we found a solution to the problem. It seems the problem is to use property_maps with bundled properties on a reverse graph. trying this typedef typedef reverse_graph<mcf_graph> reverse_graph_t; typedef property_map< reverse_graph_t, double Edge::*>::type r_res_cap_map; gives this error error: no type named ‘vertex_bundled’ in ‘class boost::reverse_graph<boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS, Port, Edge> >’ /usr/include/boost/graph/properties.hpp:419:42: error: no type named ‘edge_bundled’ in ‘class boost::reverse_graph<boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS, Port, Edge> >’ So I am assuming that it is not supported in the same way as for standard graphs? Therefore, the work around my colleague found was to make an associative property map to give to dijkstra as follows: reverse_graph_t rg(g); std::map<rev_edge_descriptor_t, double> costs; graph_traits < mcf_graph >::edge_iterator e_it, e_it_end; for ( tie(e_it, e_it_end)=edges(g); e_it!=e_it_end; e_it++) { edge_descriptor e = *e_it; vertex_descriptor s = source(e, g); vertex_descriptor t = target(e, g); rev_edge_descriptor_t rev_e = edge(t, s, rg).first; costs[rev_e] = g[e].m_cost; } boost::associative_property_map< std::map<rev_edge_descriptor_t, double> > costs_map(costs); dijkstra_shortest_paths (rg, before_p, predecessor_map ( &p[0] ).distance_map ( &d[0] ).weight_map ( costs_map ).vertex_index_map ( get ( vertex_index, rg) ) ); I send tihis email simply to follow up in case someone ends up having a similar problem. Best Regards, Ph.D. Berit Dangaard Brouer Post Doc. DTU Management Engineering, Management Science Technical University of Denmark Department of Management Engineering Produktionstorvet, Bygning 426 2800 Kgs. Lyngby blof@dtu.dk <mailto:blof@man.dtu.dk> www.ms.man.dtu.dk <http://www.ms.man.dtu.dk> http://www.maersk.com/innovation/leadingthroughinnovation/enerplan/ Please read about the ENERPLAN project here <http://www.maersk.com/innovation/leadingthroughinnovation/enerplan/> On 01/17/2014 12:42 PM, Berit Dangaard Brouer wrote:
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,
Ph.D. Berit Dangaard Brouer
Post Doc.
DTU Management Engineering, Management Science
Technical University of Denmark
Department of Management Engineering Produktionstorvet, Bygning 426 2800 Kgs. Lyngby blof@dtu.dk <mailto:blof@man.dtu.dk> www.ms.man.dtu.dk <http://www.ms.man.dtu.dk> http://www.maersk.com/innovation/leadingthroughinnovation/enerplan/
Please read about the ENERPLAN project here <http://www.maersk.com/innovation/leadingthroughinnovation/enerplan/>
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
participants (2)
-
Berit Dangaard Brouer
-
Jeremiah Willcock