Skip to content

Commit 407edfb

Browse files
authored
Merge pull request #2730 from cvvergara/enhancements-on-dijkstra
Refs/heads/enhancements on dijkstra
2 parents 28cd1f6 + 964916c commit 407edfb

19 files changed

+175
-299
lines changed

NEWS.md

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,36 @@ milestone for 4.0.0
4141
* pgr_maxFlow(Combinations)
4242
* pgr_pushRelabel(Combinations)
4343

44+
**code enhancements:**
4445

45-
**Removal of deprecated functions and signatures**
46+
* Simplify C/C++ code for all overloads of
4647

47-
* ``pgr_trspviaedges(text,integer[],double precision[],boolean,boolean,text)``
48-
* ``pgr_trspviavertices(text,anyarray,boolean,boolean,text)``
49-
* ``pgr_trsp(text,integer,double precision,integer,double precision,boolean,boolean,text)``
50-
* ``pgr_trsp(text,integer,integer,boolean,boolean,text)``
48+
* pgr_dijkstra
49+
50+
**Removal of SQL deprecated functions and signatures**
51+
52+
* pgr_trspviaedges(text,integer[],double precision[],boolean,boolean,text)
53+
* pgr_trspviavertices(text,anyarray,boolean,boolean,text)
54+
* pgr_trsp(text,integer,double precision,integer,double precision,boolean,boolean,text)
55+
* pgr_trsp(text,integer,integer,boolean,boolean,text)
56+
* _pgr_dijkstranear(text,anyarray,anyarray,bigint,boolean)
57+
* _pgr_dijkstranear(text,anyarray,bigint,bigint,boolean)
58+
* _pgr_dijkstranear(text,bigint,anyarray,bigint,boolean)
59+
* _pgr_dijkstra(text,anyarray,anyarray,boolean,boolean,boolean,bigint)
60+
* _pgr_dijkstra(text,text,boolean,boolean,boolean)
61+
62+
**Deprecation of internal C/C++ functions**
63+
64+
* _pgr_dijkstra(text,anyarray,anyarray,boolean,boolean,boolean,bigint)``
65+
* _pgr_dijkstra(text,anyarray,anyarray,boolean,boolean,boolean,bigint,boolean)``
66+
* _pgr_dijkstra(text,text,boolean,boolean,bigint,boolean)``
67+
* _pgr_dijkstra(text,text,boolean,boolean,boolean)``
5168

69+
**Internal C/C++ functions in legacy**
5270

71+
* _trsp(text,text,anyarray,anyarray,boolean)``
72+
* _v4trsp(text,text,anyarray,anyarray,boolean)``
73+
* _v4trsp(text,text,text,boolean)``
5374

5475
# pgRouting 3
5576

doc/src/release_notes.rst

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,36 @@ milestone for 4.0.0
7272
* pgr_maxFlow(Combinations)
7373
* pgr_pushRelabel(Combinations)
7474

75+
.. rubric:: code enhancements:
7576

76-
.. rubric:: Removal of deprecated functions and signatures
77+
* Simplify C/C++ code for all overloads of
7778

78-
* ``pgr_trspviaedges(text,integer[],double precision[],boolean,boolean,text)``
79-
* ``pgr_trspviavertices(text,anyarray,boolean,boolean,text)``
80-
* ``pgr_trsp(text,integer,double precision,integer,double precision,boolean,boolean,text)``
81-
* ``pgr_trsp(text,integer,integer,boolean,boolean,text)``
79+
* pgr_dijkstra
80+
81+
.. rubric:: Removal of SQL deprecated functions and signatures
82+
83+
* pgr_trspviaedges(text,integer[],double precision[],boolean,boolean,text)
84+
* pgr_trspviavertices(text,anyarray,boolean,boolean,text)
85+
* pgr_trsp(text,integer,double precision,integer,double precision,boolean,boolean,text)
86+
* pgr_trsp(text,integer,integer,boolean,boolean,text)
87+
* _pgr_dijkstranear(text,anyarray,anyarray,bigint,boolean)
88+
* _pgr_dijkstranear(text,anyarray,bigint,bigint,boolean)
89+
* _pgr_dijkstranear(text,bigint,anyarray,bigint,boolean)
90+
* _pgr_dijkstra(text,anyarray,anyarray,boolean,boolean,boolean,bigint)
91+
* _pgr_dijkstra(text,text,boolean,boolean,boolean)
92+
93+
.. rubric:: Deprecation of internal C/C++ functions
94+
95+
* _pgr_dijkstra(text,anyarray,anyarray,boolean,boolean,boolean,bigint)``
96+
* _pgr_dijkstra(text,anyarray,anyarray,boolean,boolean,boolean,bigint,boolean)``
97+
* _pgr_dijkstra(text,text,boolean,boolean,bigint,boolean)``
98+
* _pgr_dijkstra(text,text,boolean,boolean,boolean)``
8299

100+
.. rubric:: Internal C/C++ functions in legacy
83101

102+
* _trsp(text,text,anyarray,anyarray,boolean)``
103+
* _v4trsp(text,text,anyarray,anyarray,boolean)``
104+
* _v4trsp(text,text,text,boolean)``
84105

85106
pgRouting 3
86107
*******************************************************************************

include/cpp_common/combinations.hpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,6 @@ class Path;
4949

5050
namespace utilities {
5151

52-
#if 1
53-
std::map<int64_t, std::set<int64_t>>
54-
get_combinations(const II_t_rt *, size_t);
55-
56-
std::map<int64_t, std::set<int64_t>>
57-
get_combinations(int64_t*, size_t, int64_t*, size_t);
58-
#endif
5952

6053
std::map<int64_t, std::set<int64_t>>
6154
get_combinations(

include/dijkstra/dijkstraVia.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ namespace pgrouting {
4444

4545
template <class G>
4646
void
47-
pgr_dijkstraVia(
47+
dijkstraVia(
4848
G &graph,
49-
const std::vector< int64_t > &via_vertices,
50-
std::deque< Path > &paths,
49+
const std::vector<int64_t> &via_vertices,
50+
std::deque<Path> &paths,
5151
bool strict,
5252
bool U_turn_on_edge,
5353
std::ostringstream &log) {

sql/dijkstra/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ SET(LOCAL_FILES
66
dijkstraCostMatrix.sql
77
_dijkstraVia.sql
88
dijkstraVia.sql
9-
_dijkstraNear.sql
109
dijkstraNear.sql
1110
dijkstraNearCost.sql
1211
)

sql/dijkstra/_dijkstra.sql

Lines changed: 4 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
2828
2929
********************************************************************PGR-GNU*/
3030

31-
---------------
32-
---------------
33-
-- dijkstra
34-
---------------
35-
---------------
36-
37-
--v3.2
38-
CREATE FUNCTION _pgr_dijkstra(
31+
--v4.0
32+
CREATE FUNCTION _pgr_dijkstrav4(
3933
edges_sql TEXT,
34+
combinations_sql TEXT,
4035
start_vids ANYARRAY,
4136
end_vids ANYARRAY,
4237
directed BOOLEAN,
@@ -55,87 +50,6 @@ CREATE FUNCTION _pgr_dijkstra(
5550
OUT agg_cost FLOAT)
5651
RETURNS SETOF RECORD AS
5752
'MODULE_PATHNAME'
58-
LANGUAGE C VOLATILE STRICT;
59-
60-
61-
--v3.2
62-
CREATE FUNCTION _pgr_dijkstra(
63-
edges_sql TEXT,
64-
combinations_sql TEXT,
65-
directed BOOLEAN,
66-
only_cost BOOLEAN,
67-
n_goals BIGINT,
68-
global BOOLEAN,
69-
70-
OUT seq INTEGER,
71-
OUT path_seq INTEGER,
72-
OUT start_vid BIGINT,
73-
OUT end_vid BIGINT,
74-
OUT node BIGINT,
75-
OUT edge BIGINT,
76-
OUT cost FLOAT,
77-
OUT agg_cost FLOAT)
78-
RETURNS SETOF RECORD AS
79-
'MODULE_PATHNAME'
80-
LANGUAGE C VOLATILE STRICT;
81-
82-
-- COMMENTS
83-
84-
COMMENT ON FUNCTION _pgr_dijkstra(TEXT, ANYARRAY, ANYARRAY, BOOLEAN, BOOLEAN, BOOLEAN, BIGINT, BOOLEAN)
85-
IS 'pgRouting internal function';
86-
87-
COMMENT ON FUNCTION _pgr_dijkstra(TEXT, TEXT, BOOLEAN, BOOLEAN, BIGINT, BOOLEAN)
88-
IS 'pgRouting internal function';
89-
90-
91-
/** The following are kept for backward compatibility on signatures **/
92-
--v3.0
93-
CREATE FUNCTION _pgr_dijkstra(
94-
edges_sql TEXT,
95-
start_vids ANYARRAY,
96-
end_vids ANYARRAY,
97-
directed BOOLEAN DEFAULT true,
98-
only_cost BOOLEAN DEFAULT false,
99-
normal BOOLEAN DEFAULT true,
100-
n_goals BIGINT DEFAULT 0,
101-
102-
OUT seq INTEGER,
103-
OUT path_seq INTEGER,
104-
OUT start_vid BIGINT,
105-
OUT end_vid BIGINT,
106-
OUT node BIGINT,
107-
OUT edge BIGINT,
108-
OUT cost FLOAT,
109-
OUT agg_cost FLOAT)
110-
RETURNS SETOF RECORD AS
111-
'MODULE_PATHNAME'
112-
LANGUAGE C VOLATILE STRICT;
113-
114-
115-
--v3.1
116-
CREATE FUNCTION _pgr_dijkstra(
117-
edges_sql TEXT,
118-
combinations_sql TEXT,
119-
directed BOOLEAN DEFAULT true,
120-
only_cost BOOLEAN DEFAULT false,
121-
normal BOOLEAN DEFAULT true,
122-
123-
OUT seq INTEGER,
124-
OUT path_seq INTEGER,
125-
OUT start_vid BIGINT,
126-
OUT end_vid BIGINT,
127-
OUT node BIGINT,
128-
OUT edge BIGINT,
129-
OUT cost FLOAT,
130-
OUT agg_cost FLOAT)
131-
RETURNS SETOF RECORD AS
132-
'MODULE_PATHNAME'
133-
LANGUAGE C VOLATILE STRICT;
134-
135-
-- COMMENTS
53+
LANGUAGE C VOLATILE;
13654

137-
COMMENT ON FUNCTION _pgr_dijkstra(TEXT, ANYARRAY, ANYARRAY, BOOLEAN, BOOLEAN, BOOLEAN, BIGINT)
138-
IS 'pgRouting internal function';
13955

140-
COMMENT ON FUNCTION _pgr_dijkstra(TEXT, TEXT, BOOLEAN, BOOLEAN, BOOLEAN)
141-
IS 'pgRouting internal function';

sql/dijkstra/_dijkstraNear.sql

Lines changed: 0 additions & 121 deletions
This file was deleted.

sql/dijkstra/dijkstra.sql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ CREATE FUNCTION pgr_dijkstra(
5353
RETURNS SETOF RECORD AS
5454
$BODY$
5555
SELECT seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost
56-
FROM _pgr_dijkstra(_pgr_get_statement($1), ARRAY[$2]::BIGINT[], ARRAY[$3]::BIGINT[], $4, false, true);
56+
FROM _pgr_dijkstrav4(_pgr_get_statement($1), NULL::TEXT, ARRAY[$2]::BIGINT[], ARRAY[$3]::BIGINT[], $4, false, true, 0, false);
5757
$BODY$
5858
LANGUAGE sql VOLATILE STRICT
5959
COST 100
@@ -79,7 +79,7 @@ CREATE FUNCTION pgr_dijkstra(
7979
RETURNS SETOF RECORD AS
8080
$BODY$
8181
SELECT seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost
82-
FROM _pgr_dijkstra(_pgr_get_statement($1), ARRAY[$2]::BIGINT[], $3::BIGINT[], $4, false, true);
82+
FROM _pgr_dijkstrav4(_pgr_get_statement($1), NULL::TEXT, ARRAY[$2]::BIGINT[], $3::BIGINT[], $4, false, true, 0, false);
8383
$BODY$
8484
LANGUAGE sql VOLATILE STRICT
8585
COST 100
@@ -105,7 +105,7 @@ CREATE FUNCTION pgr_dijkstra(
105105
RETURNS SETOF RECORD AS
106106
$BODY$
107107
SELECT seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost
108-
FROM _pgr_dijkstra(_pgr_get_statement($1), $2::BIGINT[], ARRAY[$3]::BIGINT[], $4, false, false);
108+
FROM _pgr_dijkstrav4(_pgr_get_statement($1), NULL::TEXT, $2::BIGINT[], ARRAY[$3]::BIGINT[], $4, false, false, 0, false);
109109
$BODY$
110110
LANGUAGE sql VOLATILE STRICT
111111
COST 100
@@ -131,7 +131,7 @@ CREATE FUNCTION pgr_dijkstra(
131131
RETURNS SETOF RECORD AS
132132
$BODY$
133133
SELECT seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost
134-
FROM _pgr_dijkstra(_pgr_get_statement($1), $2::BIGINT[], $3::BIGINT[], $4, false, true);
134+
FROM _pgr_dijkstrav4(_pgr_get_statement($1), NULL::TEXT, $2::BIGINT[], $3::BIGINT[], $4, false, true, 0, false);
135135
$BODY$
136136
LANGUAGE sql VOLATILE STRICT
137137
COST 100
@@ -156,7 +156,7 @@ CREATE FUNCTION pgr_dijkstra(
156156
RETURNS SETOF RECORD AS
157157
$BODY$
158158
SELECT seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost
159-
FROM _pgr_dijkstra(_pgr_get_statement($1), _pgr_get_statement($2), $3, false, true);
159+
FROM _pgr_dijkstrav4(_pgr_get_statement($1), _pgr_get_statement($2), NULL::BIGINT[], NULL::BIGINT[], $3, false, true, 0, false);
160160
$BODY$
161161
LANGUAGE sql VOLATILE STRICT
162162
COST 100

0 commit comments

Comments
 (0)