39 const std::vector<pgr_edge_t> &edges,
40 const std::set<int64_t> &source_vertices,
41 const std::set<int64_t> &sink_vertices,
46 rev = get(boost::edge_reverse,
graph);
57 const std::vector<pgr_edge_t> &edges,
58 const std::set<int64_t> &source_vertices,
59 const std::set<int64_t> &sink_vertices,
64 rev = get(boost::edge_reverse,
graph);
66 get(boost::edge_residual_capacity,
graph);
75 const std::vector<pgr_edge_t> &edges) {
77 for (
const auto edge : edges) {
80 E e1, e1_rev, e2, e2_rev;
82 boost::tie(e1, added) = boost::add_edge(v1, v2,
graph);
83 boost::tie(e1_rev, added) =
84 boost::add_edge(v2, v1,
graph);
93 boost::tie(e2, added) = boost::add_edge(v2, v1,
graph);
94 boost::tie(e2_rev, added) =
95 boost::add_edge(v1, v2,
graph);
110 const std::vector<pgr_edge_t> &edges) {
112 for (
const auto edge : edges) {
116 boost::tie(e, added) = boost::add_edge(v1, v2,
graph);
117 boost::tie(e_rev, added) =
118 boost::add_edge(v2, v1,
graph);
133 const std::vector<pgr_edge_t> &edges,
136 for (
const auto edge : edges) {
140 boost::tie(e, added) =
141 boost::add_edge(v1, v2,
graph);
142 boost::tie(e_rev, added) =
143 boost::add_edge(v2, v1,
graph);
145 E_to_id.insert(std::pair<E, int64_t>(e_rev,
162 const std::set<int64_t> &source_vertices) {
165 for (int64_t source_id : source_vertices) {
168 boost::tie(e, added) =
170 boost::tie(e_rev, added) =
173 capacity[e] = (std::numeric_limits<int32_t>::max)();
182 const std::set<int64_t> &sink_vertices) {
185 for (int64_t sink_id : sink_vertices) {
189 boost::tie(e_rev, added) =
195 capacity[e] = (std::numeric_limits<int32_t>::max)();
203 std::vector<pgr_flow_t>
205 std::vector<pgr_flow_t> flow_edges;
207 for (boost::tie(e, e_end) = boost::edges(
graph); e != e_end;
219 flow_edges.push_back(
edge);
230 std::vector<std::vector<int64_t> > &paths) {
234 paths[path_id].push_back(v_id);
236 for (boost::tie(ei, e_end) =
237 boost::out_edges(vertex,
graph);
243 paths[path_id].push_back(v_id);
253 std::vector<General_path_element_t>
256 std::vector<General_path_element_t> path_elements;
258 std::vector<std::vector<int64_t> > paths(flow, std::vector<int64_t>());
260 Eout_it ei, e_end, ei2, e2_end;
261 for (boost::tie(ei, e_end) =
265 for (boost::tie(ei2, e2_end) =
266 boost::out_edges((*ei).m_target,
graph);
267 ei2 != e2_end; ++ei2) {
271 flow_dfs((*ei2).m_target, path_id, paths);
277 for (
size_t i = 0; i < flow; i++) {
278 size_t size = paths[i].size();
282 for (j = 0; j < size - 1; j++) {
284 edge.seq =
static_cast<int>(j + 1);
285 edge.start_id = paths[i][0];
286 edge.end_id = paths[i][size - 1];
287 edge.node = paths[i][j];
292 path_elements.push_back(
edge);
295 edge.seq =
static_cast<int>(j + 1);
296 edge.start_id = paths[i][0];
297 edge.end_id = paths[i][size - 1];
298 edge.node = paths[i][j];
300 path_elements.push_back(
edge);
302 return path_elements;