[Boost-bugs] [Boost C++ Libraries] #11658: push_relabel_max_flow

Subject: [Boost-bugs] [Boost C++ Libraries] #11658: push_relabel_max_flow
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-09-16 06:05:07


#11658: push_relabel_max_flow
-----------------------+------------------------------
 Reporter: anonymous | Type: Bugs
   Status: new | Milestone: To Be Determined
Component: None | Version: Boost 1.59.0
 Severity: Problem | Keywords:
-----------------------+------------------------------
 if you use the code below the bug would be happened:


 {{{
 #include <iostream>

 #include <boost/config.hpp>

 #include <boost/graph/boykov_kolmogorov_max_flow.hpp>
 #include <boost/graph/push_relabel_max_flow.hpp>
 #include <boost/graph/edmonds_karp_max_flow.hpp>

 #include <boost/graph/adjacency_list.hpp>
 #include <boost/graph/read_dimacs.hpp>
 #include <boost/graph/graph_utility.hpp>

 /*
 ,
 boost::property <boost::vertex_color_t, boost::default_color_type,
 boost::property <boost::vertex_distance_t, long,
 boost::property <boost::vertex_predecessor_t, Traits::edge_descriptor > >
>
 */
 typedef boost::adjacency_list_traits<boost::vecS, boost::vecS,
 boost::directedS> Traits;
 typedef boost::adjacency_list<boost::listS, boost::vecS, boost::directedS,
         boost::property < boost::vertex_name_t, std::pair<int,int>,
         boost::property < boost::vertex_color_t,
 boost::default_color_type,
         boost::property < boost::vertex_distance_t, long,
         boost::property < boost::vertex_predecessor_t,
 Traits::edge_descriptor > > > >,
         boost::property < boost::edge_capacity_t, double,
         boost::property < boost::edge_residual_capacity_t, double,
         boost::property < boost::edge_reverse_t, Traits::edge_descriptor>
> >
> Graph;

 void AddEdge( Traits::vertex_descriptor &v1,
                                 Traits::vertex_descriptor &v2,
                                 boost::property_map < Graph,
 boost::edge_reverse_t >::type &rev,
                                 const double capacity,
                                 Graph &g)
 {
         Traits::edge_descriptor e1 = boost::add_edge(v1, v2, g).first;
         Traits::edge_descriptor e2 = boost::add_edge(v2, v1, g).first;
         boost::put(boost::edge_capacity, g, e1, capacity);
         boost::put(boost::edge_capacity, g, e2, capacity);

         rev[e1] = e2;
         rev[e2] = e1;

 }

 int main(int argc, char* argv[])
 {
         Graph g;
         boost::property_map < Graph, boost::edge_reverse_t >::type rev =
 get(boost::edge_reverse, g);
         std::pair<int, int> point1(0, 0);
         std::pair<int, int> point2(1, 0);
         std::pair<int, int> point3(1, 1);
         std::pair<int, int> point4(0, 1);

         Graph::vertex_descriptor u = boost::add_vertex(point1, g);
         Graph::vertex_descriptor v = boost::add_vertex(point2, g);
         Graph::vertex_descriptor w = boost::add_vertex(point3, g);
         Graph::vertex_descriptor x = boost::add_vertex(point4, g);

         //boost::add_edge(u, v, g);
         AddEdge(u, v, rev, 10.1, g);
         AddEdge(u, w, rev, 10.2, g);
         AddEdge(v, x, rev, 8.1, g);
         AddEdge(w, x, rev, 6.2, g);

         //double flow = boost::boykov_kolmogorov_max_flow(g, u, x);
         double flow = boost::push_relabel_max_flow(g, u, x);
         //double flow = boost::edmonds_karp_max_flow(g, u, x);
         boost::property_map < Graph, boost::vertex_color_t >::type
                 vertex_color = get(boost::vertex_color, g);
         boost::graph_traits < Graph >::vertex_iterator u_iter, u_end;
         for (boost::tie(u_iter, u_end) = vertices(g); u_iter != u_end;
 ++u_iter)
         {
                 std::cout << "ver: " << *u_iter << " " <<
 vertex_color[*u_iter] << std::endl;
         }

         return 0;
 }


 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11658>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:19 UTC