Skip to content

Commit e6731b1

Browse files
authored
Merge branch 'develop' into fix/clean-restore-boyerMyrvold
2 parents 1d7f17b + be2bd04 commit e6731b1

21 files changed

Lines changed: 420 additions & 303 deletions

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ To see all issues & pull requests closed by this release see the
2121
* [#3060](https://github.com/pgRouting/pgrouting/issues/3060): dagShortestPath: use the shortest_path process and driver
2222
* [#3064](https://github.com/pgRouting/pgrouting/issues/3064): Astar: create and use a process and driver for Astar
2323
* [#3075](https://github.com/pgRouting/pgrouting/issues/3075): Spanning tree: create and use a process and driver
24+
* [#3086](https://github.com/pgRouting/pgrouting/issues/3086): MaxFlow: create and use a process and driver
2425

2526
## pgRouting 4.0
2627

doc/src/release_notes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ To see all issues & pull requests closed by this release see the
4646
* :issue:`3060`: dagShortestPath: use the shortest_path process and driver
4747
* :issue:`3064`: Astar: create and use a process and driver for Astar
4848
* :issue:`3075`: Spanning tree: create and use a process and driver
49+
* :issue:`3086`: MaxFlow: create and use a process and driver
4950

5051
pgRouting 4.0
5152
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

include/c_common/enums.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ enum Which {
4444
PRIM = 510, PRIMDD, PRIMDFS, PRIMBFS,
4545
DFS = 520,
4646
BFS = 530,
47-
DIJKSTRADD = 540
47+
DIJKSTRADD = 540,
48+
MAXFLOW, PUSHRELABEL, BOYKOV, EDMONDSKARP
4849
};
4950

5051
#endif // INCLUDE_C_COMMON_ENUMS_H_

include/cpp_common/combinations.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ get_combinations(const std::vector<II_t_rt>&);
6262
std::map<int64_t, std::set<int64_t>>
6363
get_combinations(const std::string&, ArrayType*, ArrayType*, bool, bool&);
6464

65+
std::map<int64_t, std::set<int64_t>>
66+
get_combinations(const std::string&, ArrayType*, ArrayType*, bool);
67+
6568
std::map<int64_t, std::set<int64_t>>
6669
get_combinations(const char*, ArrayType*, ArrayType*, bool);
6770

include/cpp_common/to_postgres.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
3636
#include "c_types/routes_t.h"
3737
#include "c_types/path_rt.h"
3838
#include "c_types/mst_rt.h"
39+
#include "c_types/flow_t.h"
3940

4041
#include "cpp_common/path.hpp"
4142
#include "cpp_common/base_graph.hpp"
@@ -68,6 +69,11 @@ size_t get_tuples(const std::deque<pgrouting::Path>&, Path_rt*&);
6869
*/
6970
size_t get_tuples(const std::deque<pgrouting::Path>&, MST_rt*&);
7071

72+
/*
73+
* @brief get tuples for Flow_t
74+
*/
75+
size_t get_tuples(const std::vector<Flow_t>&, Flow_t*&);
76+
7177
/*
7278
* @brief get tuples for spanning tree driver
7379
*/

include/cpp_common/utilities.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
3333

3434
#include "c_common/enums.h"
3535
#include "c_types/mst_rt.h"
36+
#include "c_types/flow_t.h"
3637

3738
namespace pgrouting {
3839

@@ -42,6 +43,7 @@ std::string get_name(Which, bool, bool, bool);
4243
char estimate_drivingSide(char, Which);
4344
void get_new_queries(const std::string&, const std::string&, std::string&, std::string&);
4445
std::vector<MST_rt> only_root_result(const std::set<int64_t>&);
46+
std::vector<Flow_t> only_maxFlow_result(int64_t);
4547

4648
} // namespace pgrouting
4749

include/drivers/maxFlow_driver.hpp

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*PGR-GNU*****************************************************************
2+
File: maxFlow_driver.hpp
3+
4+
Generated with Template by:
5+
Copyright (c) 2007-2026 pgRouting developers
6+
Mail: project@pgrouting.org
7+
8+
Function's developer:
9+
Copyright (c) 2016 Andrea Nardelli
10+
Mail: nrd.nardelli@gmail.com
11+
12+
------
13+
14+
This program is free software; you can redistribute it and/or modify
15+
it under the terms of the GNU General Public License as published by
16+
the Free Software Foundation; either version 2 of the License, or
17+
(at your option) any later version.
18+
19+
This program is distributed in the hope that it will be useful,
20+
but WITHOUT ANY WARRANTY; without even the implied warranty of
21+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22+
GNU General Public License for more details.
23+
24+
You should have received a copy of the GNU General Public License
25+
along with this program; if not, write to the Free Software
26+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27+
28+
********************************************************************PGR-GNU*/
29+
30+
#ifndef INCLUDE_DRIVERS_MAXFLOW_DRIVER_HPP_
31+
#define INCLUDE_DRIVERS_MAXFLOW_DRIVER_HPP_
32+
33+
#include <cstddef>
34+
#include <cstdint>
35+
#include <string>
36+
#include <sstream>
37+
38+
#include "c_common/enums.h"
39+
40+
using Flow_t = struct Flow_t;
41+
using ArrayType = struct ArrayType;
42+
43+
namespace pgrouting {
44+
namespace drivers {
45+
46+
void do_maxFlow(
47+
const std::string&, const std::string&,
48+
ArrayType*, ArrayType*,
49+
50+
Which,
51+
Flow_t*&, size_t&,
52+
std::ostringstream&, std::ostringstream&, std::ostringstream&);
53+
54+
} // namespace drivers
55+
} // namespace pgrouting
56+
57+
#endif // INCLUDE_DRIVERS_MAXFLOW_DRIVER_HPP_

include/max_flow/maxflow.hpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
4444

4545
#include "c_types/flow_t.h"
4646
#include "cpp_common/edge_t.hpp"
47+
#include "c_common/enums.h"
4748
#include "c_types/path_rt.h"
4849
#include "cpp_common/interruption.hpp"
4950

@@ -107,10 +108,10 @@ class PgrFlowGraph {
107108
}
108109

109110
PgrFlowGraph(
110-
const std::vector<Edge_t> &edges,
111-
const std::set<int64_t> &source_vertices,
112-
const std::set<int64_t> &sink_vertices,
113-
int algorithm);
111+
const std::vector<Edge_t>&,
112+
const std::set<int64_t>&,
113+
const std::set<int64_t>&,
114+
Which);
114115

115116
PgrFlowGraph(
116117
const std::vector<Edge_t> &edges,
Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*PGR-GNU*****************************************************************
2-
File: max_flow_driver.h
2+
File: maxFlow_process.h
33
44
Generated with Template by:
55
Copyright (c) 2007-2026 pgRouting developers
@@ -27,49 +27,38 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
2727
2828
********************************************************************PGR-GNU*/
2929

30-
#ifndef INCLUDE_DRIVERS_MAX_FLOW_MAX_FLOW_DRIVER_H_
31-
#define INCLUDE_DRIVERS_MAX_FLOW_MAX_FLOW_DRIVER_H_
30+
#ifndef INCLUDE_PROCESS_MAXFLOW_PROCESS_H_
31+
#define INCLUDE_PROCESS_MAXFLOW_PROCESS_H_
3232
#pragma once
3333

3434
#ifdef __cplusplus
35-
extern "C" {
36-
#endif
37-
38-
#include <postgres.h>
39-
#include <utils/array.h>
40-
41-
#ifdef __cplusplus
42-
}
43-
#endif
44-
45-
#include "cpp_common/undefPostgresDefine.hpp"
46-
47-
#ifdef __cplusplus
48-
# include <cstddef>
49-
# include <cstdint>
35+
#include <cstddef>
36+
#include <cstdint>
5037
using Flow_t = struct Flow_t;
38+
using ArrayType = struct ArrayType;
5139
#else
52-
# include <stddef.h>
53-
# include <stdint.h>
40+
#include <stddef.h>
41+
#include <stdint.h>
42+
#include <stdbool.h>
5443
typedef struct Flow_t Flow_t;
44+
typedef struct ArrayType ArrayType;
5545
#endif
5646

47+
#include "c_common/enums.h"
48+
5749
#ifdef __cplusplus
5850
extern "C" {
5951
#endif
6052

61-
void pgr_do_max_flow(
62-
const char*,
63-
const char*,
53+
void pgr_process_maxFlow(
54+
const char*, const char*,
6455
ArrayType*, ArrayType*,
6556

66-
int, bool,
67-
68-
Flow_t**, size_t*,
69-
char**, char**, char**);
57+
enum Which,
58+
Flow_t**, size_t*);
7059

7160
#ifdef __cplusplus
7261
}
7362
#endif
7463

75-
#endif // INCLUDE_DRIVERS_MAX_FLOW_MAX_FLOW_DRIVER_H_
64+
#endif // INCLUDE_PROCESS_MAXFLOW_PROCESS_H_

locale/en/LC_MESSAGES/pgrouting_doc_strings.po

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: pgRouting v4.1\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2026-03-02 03:45+0000\n"
11+
"POT-Creation-Date: 2026-03-01 21:16+0000\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -3964,6 +3964,11 @@ msgid ""
39643964
"tree: create and use a process and driver"
39653965
msgstr ""
39663966

3967+
msgid ""
3968+
"`#3086 <https://github.com/pgRouting/pgrouting/issues/3086>`__: MaxFlow: "
3969+
"create and use a process and driver"
3970+
msgstr ""
3971+
39673972
msgid "All releases"
39683973
msgstr ""
39693974

0 commit comments

Comments
 (0)