4

A part of my algorithm requires to compute maximum flow in a network with integer capacities. I want to use boost::edmonds_karp_max_flow algorithm to find the maximum flow.

I tried reading the documentation but it was very difficult for me as I have never used BGL before. I have created the graph as follows where the weight attribute of the Edge must be used as capacity of the edges in the graph.

struct Vertex{
    int id;
    bool flag;
};
struct Edge{
    int weight;
};
 typedef boost::adjacency_list<  
    boost::listS,               
    boost::vecS,                
    boost::undirectedS,         
    Vertex,                     
    Edge                        
 >MyGraph;

My goal is to write the following function

 int max_flow( const MyGraph& gr, int u, int v) {
       // compute the maximum flow between vertices with ids u,v
 }

can someone show me with an example how to implement this function ?

Alex Bitek
  • 6,529
  • 5
  • 47
  • 77
Graddy
  • 2,828
  • 5
  • 19
  • 25
  • there is an example here: http://www.boost.org/doc/libs/1_46_1/libs/graph/example/edmonds-karp-eg.cpp – Irit Katriel Feb 16 '12 at 14:11
  • You can see sample of this function in my recent post (in c++): http://stackoverflow.com/questions/9445400/missing-some-paths-in-edmonds-karp-max-flow-algorithm – Saeed Amiri Feb 25 '12 at 15:48

0 Answers0