Reputation: 5645
My graph has the following declaration
struct vertex_info
{
std::string name;
std::string label;
unsigned int type;
bool isND;
};
struct edge_info
{
std::string name;
long capacity;
long residualCapacity;
long rev;
};
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS
, vertex_info, edge_info > expr_graph_t;
I have constructed a graph (flow network) flowG
with source
and sink
nodes. Now I want to calculate max-flow using push_relabel
method given in boost graph library. I am calling the function as following .
push_relabel_max_flow(flowG, source, sink
, get(&edge_info::capacity, flowG)
, get(&edge_info::residualCapacity, flowG)
, get(&edge_info::rev, flowG)
, get(boost::vertex_index, flowG)
);
Compiler (g++) is generating long error messages (pasted here). I suspect that I am not able to pass correct types of maps to the function. Function signature is available here in boost-doc.
There are many examples given in document but they are using a graph is different than mine. I can not change the graph declaration else a lot of code will break. I am not used to boost property_map
concept.
Upvotes: 3
Views: 406
Reputation: 5645
This solution is due to llonesmiz.
The problem is that reverse_edge_map
requires a property map with key_type=edge_descriptor
and value_type=edge_descriptor
and the one I used has value_type=long
. I declared rev
as adjacency_list_traits<vecS,vecS,bidirectionalS>::edge_descriptor
. And it compiled thought I generated a seg-fault which I believe is a problem with logic of function and not with the prototype of the function.
Upvotes: 2