1 #include <boost/graph/adjacency_list.hpp>
2 #include <boost/core/lightweight_test.hpp>
3 #include <boost/graph/edmonds_karp_max_flow.hpp>
5 #include "min_cost_max_flow_utils.hpp"
7 typedef boost::adjacency_list_traits
< boost::vecS
, boost::vecS
,
14 float residual_capacity
;
15 traits::edge_descriptor reversed_edge
;
19 traits::edge_descriptor predecessor
;
22 boost::vertex_index_t id
;
23 boost::default_color_type color
;
25 typedef boost::adjacency_list
< boost::listS
, boost::vecS
, boost::directedS
,
29 void using_named_parameters_and_bundled_params_on_edmonds_karp_max_flow_test()
32 traits::vertex_descriptor s
, t
;
34 boost::property_map
< Graph
, double edge_t::* >::type capacity
35 = get(&edge_t::capacity
, g
);
36 boost::property_map
< Graph
, float edge_t::* >::type cost
37 = get(&edge_t::cost
, g
);
38 boost::property_map
< Graph
, float edge_t::* >::type residual_capacity
39 = get(&edge_t::residual_capacity
, g
);
40 boost::property_map
< Graph
, traits::edge_descriptor
edge_t::* >::type rev
41 = get(&edge_t::reversed_edge
, g
);
42 boost::property_map
< Graph
, traits::edge_descriptor
node_t::* >::type pred
43 = get(&node_t::predecessor
, g
);
44 boost::property_map
< Graph
, boost::default_color_type
node_t::* >::type col
45 = get(&node_t::color
, g
);
47 boost::SampleGraph::getSampleGraph(
48 g
, s
, t
, capacity
, residual_capacity
, cost
, rev
);
50 // The "named parameter version" (producing errors)
51 // I chose to show the error with edmonds_karp_max_flow().
52 int flow_value
= edmonds_karp_max_flow(g
, s
, t
,
53 boost::capacity_map(capacity
)
54 .residual_capacity_map(residual_capacity
)
55 .reverse_edge_map(rev
)
57 .predecessor_map(pred
));
59 BOOST_TEST_EQ(flow_value
, 4);
64 using_named_parameters_and_bundled_params_on_edmonds_karp_max_flow_test();
65 return boost::report_errors();