27 #ifndef INCLUDE_MAX_FLOW_PGR_MAXFLOW_HPP_
28 #define INCLUDE_MAX_FLOW_PGR_MAXFLOW_HPP_
33 #include <boost/graph/push_relabel_max_flow.hpp>
34 #include <boost/graph/edmonds_karp_max_flow.hpp>
35 #include <boost/graph/boykov_kolmogorov_max_flow.hpp>
56 typedef boost::graph_traits<FlowGraph>::vertex_descriptor
V;
57 typedef boost::graph_traits<FlowGraph>::edge_descriptor
E;
58 typedef boost::graph_traits<FlowGraph>::vertex_iterator
V_it;
59 typedef boost::graph_traits<FlowGraph>::edge_iterator
E_it;
60 typedef boost::graph_traits<FlowGraph>::out_edge_iterator
Eout_it;
74 CHECK_FOR_INTERRUPTS();
75 return boost::push_relabel_max_flow(
83 CHECK_FOR_INTERRUPTS();
84 return boost::edmonds_karp_max_flow(
92 CHECK_FOR_INTERRUPTS();
93 return boost::boykov_kolmogorov_max_flow(
101 CHECK_FOR_INTERRUPTS();
102 auto flow = boost::boykov_kolmogorov_max_flow(
110 const std::vector<pgr_edge_t> &edges,
111 const std::set<int64_t> &source_vertices,
112 const std::set<int64_t> &sink_vertices,
116 const std::vector<pgr_edge_t> &edges,
117 const std::set<int64_t> &source_vertices,
118 const std::set<int64_t> &sink_vertices,
141 const std::set<int64_t> &source_vertices);
143 const std::set<int64_t> &sink_vertices);
146 const std::vector<pgr_edge_t> &edges);
148 const std::vector<pgr_edge_t> &edges);
150 const std::vector<pgr_edge_t> &edges,
156 std::vector<std::vector<int64_t> > &paths);
161 template <
typename T>
164 const std::set<int64_t> &source_vertices,
165 const std::set<int64_t> &sink_vertices) {
166 std::set<int64_t> vertices(source_vertices);
167 vertices.insert(sink_vertices.begin(), sink_vertices.end());
169 for (
const auto e : edges) {
170 vertices.insert(e.source);
171 vertices.insert(e.target);
174 for (
const auto id : vertices) {
176 id_to_V.insert(std::pair<int64_t, V>(
id, v));
177 V_to_id.insert(std::pair<V, int64_t>(v,
id));
202 #endif // INCLUDE_MAX_FLOW_PGR_MAXFLOW_HPP_