diff --git a/include/cpp_common/pgr_base_graph.hpp b/include/cpp_common/pgr_base_graph.hpp index 7fc312081a..21289fbc85 100644 --- a/include/cpp_common/pgr_base_graph.hpp +++ b/include/cpp_common/pgr_base_graph.hpp @@ -529,7 +529,7 @@ class Pgr_base_graph { @return V: The vertex descriptor of the vertex */ V get_V(int64_t vid) const { - pgassert(has_vertex(vid)); + // pgassert(has_vertex(vid)); return vertices_map.find(vid)->second; } diff --git a/include/dijkstra/v4drivingDist.hpp b/include/dijkstra/v4drivingDist.hpp index ea6dcc5f82..430ebb8f83 100644 --- a/include/dijkstra/v4drivingDist.hpp +++ b/include/dijkstra/v4drivingDist.hpp @@ -44,23 +44,18 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. #include #include #include +#include #include #include #include -#include "c_types/ii_t_rt.h" #include "cpp_common/basePath_SSEC.hpp" #include "cpp_common/pgr_base_graph.hpp" #include "cpp_common/interruption.h" #include "visitors/dijkstra_visitors.hpp" -#include -#include -#include -#include #include -#include "cpp_common/basePath_SSEC.hpp" #include #include @@ -516,8 +511,8 @@ class ShortestPath_tree{ const G&); std::deque dfs_order( - const G&, - int64_t); + const G&, + int64_t); void get_edges_from_path( const G&, @@ -556,7 +551,9 @@ ShortestPath_tree::get_results( } if (depth[u] == 0 && depth[v] == 0) { - if (graph[u].id != root) std::swap(u, v); + if (graph[u].id != root) { + std::swap(u, v); + } if (!p_root && graph[u].id > graph[v].id) std::swap(u, v); root = p_root? p_root: graph[u].id; @@ -573,7 +570,7 @@ ShortestPath_tree::get_results( depth[v] = depth[u] == -1? 1 : depth[u] + 1; if (graph[v].id < 0) depth[v] = depth[u]; - if (graph[v].id > 0){ + if (graph[v].id > 0) { results.push_back({ root, depth[v], @@ -621,7 +618,7 @@ ShortestPath_tree::dfs_order(const G &graph, int64_t root) { } else { results.push_back({root, 0, root, -1, 0.0, 0.0}); } - + return results; } @@ -630,19 +627,17 @@ template void ShortestPath_tree::get_edges_from_path( const G& graph, - const Path path){ - // m_spanning_tree.clear(); - - for (size_t i = 0; i < path.size(); i++){ + const Path path) { + for (size_t i = 0; i < path.size(); i++) { auto u = graph.get_V(path[i].node); - for (size_t j = i+1; j < path.size(); j++){ + for (size_t j = i+1; j < path.size(); j++) { auto v = graph.get_V(path[j].node); - double cost = path[j].cost; + double cost = path[j].cost; auto edge = graph.get_edge(u, v, cost); - if(graph.target(edge) == v - && path[i].agg_cost+cost == path[j].agg_cost - && graph[edge].id == path[j].edge){ + if (graph.target(edge) == v + && path[i].agg_cost+cost == path[j].agg_cost + && graph[edge].id == path[j].edge) { this->m_spanning_tree.edges.insert(edge); } } @@ -654,13 +649,12 @@ std::deque ShortestPath_tree::get_depths( G &graph, std::deque paths) { - std::deque results; for (const Path& path : paths) { - get_edges_from_path(graph, path); - int64_t root = path.start_id(); - auto result = this->dfs_order(graph, root); + get_edges_from_path(graph, path); + int64_t root = path.start_id(); + auto result = this->dfs_order(graph, root); std::sort(result.begin(), result.end(), [](const MST_rt &l, const MST_rt &r) @@ -670,12 +664,12 @@ ShortestPath_tree::get_depths( {return l.agg_cost < r.agg_cost;}); results.insert(results.end(), result.begin(), result.end()); - } + } return results; } -} +} // namespace functions } // namespace pgrouting diff --git a/include/drivers/driving_distance/v4drivedist_driver.h b/include/drivers/driving_distance/v4drivedist_driver.h index 1ed0f0a50f..4cf0f3c74f 100644 --- a/include/drivers/driving_distance/v4drivedist_driver.h +++ b/include/drivers/driving_distance/v4drivedist_driver.h @@ -60,4 +60,4 @@ extern "C" { } #endif -#endif //INCLUDE_DRIVERS_DRIVING_DISTANCE_V4DRIVEDIST_DRIVER_H_ +#endif // INCLUDE_DRIVERS_DRIVING_DISTANCE_V4DRIVEDIST_DRIVER_H_ diff --git a/pgtap/dijkstra/driving_distance/edge_cases/issue_1152.pg b/pgtap/dijkstra/driving_distance/edge_cases/issue_1152.pg index 1e14e402ca..8d74104b4d 100644 --- a/pgtap/dijkstra/driving_distance/edge_cases/issue_1152.pg +++ b/pgtap/dijkstra/driving_distance/edge_cases/issue_1152.pg @@ -90,7 +90,7 @@ language plpgsql; SELECT * FROM issue1154(); SELECT lives_ok($$ - SELECT * + SELECT seq, start_vid, node, edge, cost, agg_cost FROM pgr_drivingdistance( 'SELECT * FROM tmp_net', ARRAY[ diff --git a/pgtap/dijkstra/driving_distance/edge_cases/issue_519.pg b/pgtap/dijkstra/driving_distance/edge_cases/issue_519.pg index adcce5b3f2..b844e7447e 100644 --- a/pgtap/dijkstra/driving_distance/edge_cases/issue_519.pg +++ b/pgtap/dijkstra/driving_distance/edge_cases/issue_519.pg @@ -34,7 +34,7 @@ PREPARE q3 AS SELECT 25 AS start_vid, node, edge, cost, agg_cost FROM pgr_drivingDistance( 'select id, source, target, cost from edge_table', 25, 3.5); -/* TODO check C/C++ code because it is crashing the server when using ARRAY' +/* TODO check C/C++ code because it is crashing the server when using ARRAY*/ Prepare q4 AS SELECT start_vid, node, edge, cost, agg_cost FROM pgr_drivingDistance( 'select id, source, target, cost from edge_table', ARRAY[1, 5, 25], 3.5); diff --git a/pgtap/dijkstra/driving_distance/types_check.pg b/pgtap/dijkstra/driving_distance/types_check.pg index e3bdb0de86..c0a66c5d0b 100644 --- a/pgtap/dijkstra/driving_distance/types_check.pg +++ b/pgtap/dijkstra/driving_distance/types_check.pg @@ -47,8 +47,8 @@ RETURN QUERY SELECT set_eq( $$SELECT proallargtypes from pg_proc where proname = 'pgr_drivingdistance'$$, $$VALUES - ('{25,20,701,16,23,20,20,20,20,701,701}'::OID[]), - ('{25,2277,701,16,16,23,20,20,20,20,701,701}'::OID[]) + ('{25,20,701,16,20,20,20,20,20,701,701}'::OID[]), + ('{25,2277,701,16,16,20,20,20,20,20,701,701}'::OID[]) $$); ELSE -- old signatures @@ -65,7 +65,7 @@ SELECT set_eq( $$SELECT proallargtypes from pg_proc where proname = 'pgr_drivingdistance'$$, $$VALUES ('{25,20,701,16,23,20,20,701,701}'::OID[]), - ('{25,2277,701,16,16,23,20,20,20,701,701}'::OID[]) + ('{25,2277,701,16,16,20,20,20,20,701,701}'::OID[]) $$); END IF; END; diff --git a/sql/driving_distance/_drivingDistance.sql b/sql/driving_distance/_drivingDistance.sql index 057e963140..af556d078c 100644 --- a/sql/driving_distance/_drivingDistance.sql +++ b/sql/driving_distance/_drivingDistance.sql @@ -36,7 +36,7 @@ CREATE FUNCTION _pgr_v4drivingDistance( distance FLOAT, directed BOOLEAN DEFAULT TRUE, equicost BOOLEAN DEFAULT FALSE, - OUT seq INTEGER, + OUT seq BIGINT, OUT depth BIGINT, OUT start_vid BIGINT, OUT node BIGINT, diff --git a/sql/driving_distance/drivingDistance.sql b/sql/driving_distance/drivingDistance.sql index 68917adee2..fefb5891e2 100644 --- a/sql/driving_distance/drivingDistance.sql +++ b/sql/driving_distance/drivingDistance.sql @@ -35,7 +35,7 @@ CREATE FUNCTION pgr_drivingDistance( directed BOOLEAN DEFAULT TRUE, equicost BOOLEAN DEFAULT FALSE, - OUT seq INTEGER, + OUT seq BIGINT, OUT depth BIGINT, OUT start_vid BIGINT, OUT node BIGINT, @@ -61,7 +61,7 @@ CREATE FUNCTION pgr_drivingDistance( directed BOOLEAN DEFAULT TRUE, - OUT seq INTEGER, + OUT seq BIGINT, OUT depth BIGINT, OUT start_vid BIGINT, OUT node BIGINT, diff --git a/sql/sigs/pgrouting--3.6.sig b/sql/sigs/pgrouting--3.6.sig index 263a2828cb..e0a4df22df 100644 --- a/sql/sigs/pgrouting--3.6.sig +++ b/sql/sigs/pgrouting--3.6.sig @@ -134,7 +134,6 @@ pgr_dijkstravia(text,anyarray,boolean,boolean,boolean) _pgr_drivingdistance(text,anyarray,double precision,boolean,boolean) pgr_drivingdistance(text,anyarray,double precision,boolean,boolean) pgr_drivingdistance(text,bigint,double precision,boolean) -_pgr_v4drivingdistance(text,anyarray,double precision,boolean,boolean) _pgr_edgecoloring(text) pgr_edgecoloring(text) _pgr_edgedisjointpaths(text,anyarray,anyarray,boolean) @@ -292,6 +291,7 @@ _pgr_tsp(text,bigint,bigint,double precision,integer,integer,integer,double prec pgr_tsp(text,bigint,bigint,double precision,integer,integer,integer,double precision,double precision,double precision,boolean) _pgr_turnrestrictedpath(text,text,bigint,bigint,integer,boolean,boolean,boolean,boolean) pgr_turnrestrictedpath(text,text,bigint,bigint,integer,boolean,boolean,boolean,boolean) +_pgr_v4drivingdistance(text,anyarray,double precision,boolean,boolean) pgr_version() _pgr_versionless(text,text) _pgr_vrponedepot(text,text,text,integer)