Sign in to follow this  
Ey-Lord

Boost graph question

Recommended Posts

Hey guys :) I'm working on the "maximum flow" problem . I'm trying to use the " push_relabel_max_flow " function of the boost::graph lib. http://www.boost.org/libs/graph/doc/push_relabel_max_flow.html And im missing some things ; i've build my directed graph with all the edges and their capacity value , i got 2 edge with a property string = "source" & "sink" . Their is a few things i dont understand : - how do i create the reverse of edges ? do i have to to this by myself ? - i need 2 vertex_descriptor ( sink / source ), if my code corrrect :
typedef graph_traits < Graph >::vertex_descriptor Vertex ;
Vertex s s2 ;
I also wonder how do i affect those vertex to the 2 taht i need ( labled source and sink ) . Do i have to parse all my vertice and do something like this :
typedef graph_traits < Graph >::vertex_iterator vertex_it ;
std::pair<vertex_it, vertex_it> vp;
for ( vp = vertices(Network) ;vp.first != vp.second; ++vp.first)
{
   if (  name[*vp.first] == "sink" ) s2 = *vp.first ;
   if ( name[*vp.first] == "source" ) s = *vp.first ;
}
i just created my graph like this
typedef adjacency_list_traits<vecS, vecS, directedS> Traits;

typedef adjacency_list < vecS, vecS, directedS,Etat, property <edge_capacity_t , long,
                                                     property <edge_residual_capacity_t, long,  
													 property <edge_reverse_t, Traits::edge_descriptor > > > > Graph;

Etat is the string property . I dont know what does the last property do ... im kinda confused if you got any tips ... EDIT : one sentence that bugs me : " The ReverseEdgeMap argument rev must map each edge in the original graph to its reverse edge, that is (u,v) -> (v,u) for all (u,v) in E " What exatly do i have to do ? [Edited by - Ey-Lord on May 30, 2005 7:45:49 AM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this