On Sat, 18 Feb 2012, coolhead.pranay@gmail.com wrote:
Hi,
I want to use BGL to compute the maximum flow in a network. Following is the definition of Graph that I am using
typedef adjacency_list_traits < listS, listS, bidirectionalS > Traits; typedef adjacency_list < listS, listS, bidirectionalS, property < vertex_name_t, int >, property < edge_capacity_t, long, property < edge_residual_capacity_t, long, property < edge_reverse_t, Traits::edge_descriptor > > > > Graph; . Before computing the max flow, I have the following optional parameters setup
property_map < Graph, edge_capacity_t >::type capacity = get(edge_capacity, this->g); property_map < Graph, edge_reverse_t >::type rev = get(edge_reverse, this->g); property_map < Graph, edge_residual_capacity_t >::type residual_capacity = get(edge_residual_capacity, this->g); property_map < Graph, vertex_name_t >::type vname = get(vertex_name,this->g);
std::vector
color(num_vertices(this->g)); std::vectorTraits::edge_descriptor pred(num_vertices(this->g)); The call to the algorithm is..
int flow = edmonds_karp_max_flow(g, s, t, capacity, residual_capacity, rev, &color[0], &pred[0]);
When I try to compile the program it fails with the following error message. Can someone explain the reason for this ?
The problem stems from your use of the listS selector for your vertex container; choosing vecS instead is likely to make the code work. If you need to use listS for some reason, you will need to do more changes to get the code to work; if you need to know about that, please reply to the list and I will put in all of the steps you need to do. Using vecS is by far the simplest solution, though. -- Jeremiah Willcock