Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
Checks: >
google-*,
-google-readability-braces-around-statements,
-google-readability-casting,
clang-analyzer-*,
clang-diagnostic-*,
Expand Down
2 changes: 1 addition & 1 deletion include/astar/astar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <boost/graph/astar_search.hpp>

#include "visitors/astar_visitors.hpp"
#include "cpp_common/basePath_SSEC.hpp"
#include "cpp_common/path.hpp"
#include "cpp_common/base_graph.hpp"
#include "cpp_common/interruption.hpp"
#include "c_types/ii_t_rt.h"
Expand Down
2 changes: 1 addition & 1 deletion include/bdAstar/bdAstar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <cstdint>

#include "cpp_common/bidirectional.hpp"
#include "cpp_common/basePath_SSEC.hpp"
#include "cpp_common/path.hpp"

namespace pgrouting {

Expand Down
2 changes: 1 addition & 1 deletion include/bdDijkstra/bdDijkstra.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


#include "cpp_common/bidirectional.hpp"
#include "cpp_common/basePath_SSEC.hpp"
#include "cpp_common/path.hpp"


namespace pgrouting {
Expand Down
2 changes: 1 addition & 1 deletion include/bellman_ford/bellman_ford.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/bellman_ford_shortest_paths.hpp>
#include "cpp_common/messages.hpp"
#include "cpp_common/basePath_SSEC.hpp"
#include "cpp_common/path.hpp"
#include "cpp_common/base_graph.hpp"
#include "cpp_common/interruption.hpp"
#include "c_types/ii_t_rt.h"
Expand Down
2 changes: 1 addition & 1 deletion include/bellman_ford/edwardMoore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <map>
#include <cstdint>

#include "cpp_common/basePath_SSEC.hpp"
#include "cpp_common/path.hpp"
#include "cpp_common/base_graph.hpp"
#include "cpp_common/interruption.hpp"

Expand Down
2 changes: 1 addition & 1 deletion include/breadthFirstSearch/binaryBreadthFirstSearch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <map>
#include <cstdint>

#include "cpp_common/basePath_SSEC.hpp"
#include "cpp_common/path.hpp"
#include "cpp_common/base_graph.hpp"
#include "cpp_common/assert.hpp"

Expand Down
6 changes: 4 additions & 2 deletions include/chinese/chinesePostman.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,12 @@ PgrDirectedChPPGraph::PgrDirectedChPPGraph(const std::vector<Edge_t> &dataEdges)
edge.cost = 0.0;
edge.capacity = std::abs(d);
edge.edge_id = 0;
if (d > 0)
if (d > 0) {
edge.source = p, edge.target = superTarget;
if (d < 0)
}
if (d < 0) {
edge.source = superSource, edge.target = p;
}
edges.push_back(edge);
}

Expand Down
2 changes: 1 addition & 1 deletion include/circuits/hawickcircuits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/hawick_circuits.hpp>

#include "cpp_common/basePath_SSEC.hpp"
#include "cpp_common/path.hpp"
#include "cpp_common/base_graph.hpp"
#include "cpp_common/interruption.hpp"
#include "cpp_common/assert.hpp"
Expand Down
2 changes: 1 addition & 1 deletion include/cpp_common/bidirectional.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include "cpp_common/assert.hpp"

#include "cpp_common/basePath_SSEC.hpp"
#include "cpp_common/path.hpp"
#include "cpp_common/base_graph.hpp"


Expand Down
2 changes: 1 addition & 1 deletion include/cpp_common/combinations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


#include "c_types/ii_t_rt.h"
#include "cpp_common/basePath_SSEC.hpp"
#include "cpp_common/path.hpp"
#include "cpp_common/rule.hpp"


Expand Down
2 changes: 1 addition & 1 deletion include/cpp_common/compPaths.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#define INCLUDE_CPP_COMMON_COMPPATHS_HPP_
#pragma once

#include "cpp_common/basePath_SSEC.hpp"
#include "cpp_common/path.hpp"

namespace pgrouting {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*PGR-GNU*****************************************************************
File: basePath_SSEC.hpp
File: path.hpp

Copyright (c) 2015 pgRouting developers
Mail: [email protected]
Expand Down
10 changes: 8 additions & 2 deletions include/cpp_common/to_postgres.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include "c_types/contractionHierarchies_rt.h"
#include "c_types/iid_t_rt.h"
#include "c_types/routes_t.h"

#include "cpp_common/path.hpp"
#include "cpp_common/base_graph.hpp"
#include "cpp_common/alloc.hpp"
#include "cpp_common/identifiers.hpp"


namespace pgrouting {
namespace to_postgres {
namespace detail {

/** @brief Count results that are going to be passed to postgres
Expand Down Expand Up @@ -68,8 +71,6 @@ count_rows(

} // namespace detail

namespace to_postgres {

/** @brief Stored results on a vector are saved on a C array
*
* @param[in] graph Created graph with the base Graph
Expand Down Expand Up @@ -203,6 +204,11 @@ void graph_to_tuple(
}
}

/*
* @brief Via Routes save on a C array
*/
size_t get_viaRoute(std::deque<pgrouting::Path>&, Routes_t**);

} // namespace to_postgres
} // namespace pgrouting

Expand Down
2 changes: 1 addition & 1 deletion include/dagShortestPath/dagShortestPath.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/dag_shortest_paths.hpp>

#include "cpp_common/basePath_SSEC.hpp"
#include "cpp_common/path.hpp"
#include "cpp_common/base_graph.hpp"
#include "cpp_common/interruption.hpp"

Expand Down
2 changes: 1 addition & 1 deletion include/dijkstra/dijkstra.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <boost/graph/dijkstra_shortest_paths.hpp>

#include "c_types/ii_t_rt.h"
#include "cpp_common/basePath_SSEC.hpp"
#include "cpp_common/path.hpp"
#include "cpp_common/base_graph.hpp"
#include "cpp_common/interruption.hpp"
#include "visitors/dijkstra_visitors.hpp"
Expand Down
5 changes: 3 additions & 2 deletions include/dijkstra/drivingDist.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>

#include "cpp_common/basePath_SSEC.hpp"
#include "cpp_common/path.hpp"
#include "cpp_common/base_graph.hpp"
#include "cpp_common/interruption.hpp"
#include "visitors/dijkstra_visitors.hpp"
Expand Down Expand Up @@ -405,8 +405,9 @@ std::deque<pgrouting::Path> drivingDistance_with_equicost(
*/
for (const auto &root : roots) {
for (auto &p : pred) {
if (!p.empty() && graph.has_vertex(root))
if (!p.empty() && graph.has_vertex(root)) {
p[graph.get_V(root)] = graph.get_V(root);
}
}
}

Expand Down
4 changes: 1 addition & 3 deletions include/max_flow/minCostMaxFlow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ class PgrCostFlowGraph {
}

int64_t GetEdgeId(E e) const {
if (eToId.find(e) == eToId.end())
return -1;
return eToId.at(e);
return eToId.find(e) == eToId.end()? -1 : eToId.at(e);
}

void SetSupersource(
Expand Down
2 changes: 1 addition & 1 deletion include/mincut/stoerWagner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <functional>
#include <limits>

#include "cpp_common/basePath_SSEC.hpp"
#include "cpp_common/path.hpp"
#include <boost/config.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graph_traits.hpp>
Expand Down
3 changes: 2 additions & 1 deletion include/spanningTree/mst.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,9 @@ class Pgr_mst {

bool no_neg_costs(const G &graph) {
E_i ei, ei_end;
for (boost::tie(ei, ei_end) = edges(graph.graph); ei != ei_end; ++ei)
for (boost::tie(ei, ei_end) = edges(graph.graph); ei != ei_end; ++ei) {
pgassert(graph[*ei].cost > 0);
}
return true;
}
};
Expand Down
2 changes: 1 addition & 1 deletion include/spanningTree/pgr_randomSpanningTree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <boost/random/random_number_generator.hpp>
#include <boost/graph/graph_traits.hpp>

#include "cpp_common/basePath_SSEC.hpp"
#include "cpp_common/path.hpp"
#include "cpp_common/pgr_base_graph.hpp"
#include "cpp_common/interruption.hpp"

Expand Down
2 changes: 1 addition & 1 deletion include/topologicalSort/topologicalSort.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <boost/typeof/typeof.hpp>
#include <boost/graph/topological_sort.hpp>

#include "cpp_common/basePath_SSEC.hpp"
#include "cpp_common/path.hpp"
#include "cpp_common/base_graph.hpp"
#include "cpp_common/interruption.hpp"
#include "c_types//i_rt.h"
Expand Down
2 changes: 1 addition & 1 deletion include/trsp/trspHandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <cstdint>


#include "cpp_common/basePath_SSEC.hpp"
#include "cpp_common/path.hpp"
#include "trsp/edgeInfo.hpp"
#include "cpp_common/rule.hpp"
#include "cpp_common/messages.hpp"
Expand Down
3 changes: 2 additions & 1 deletion include/visitors/dfs_visitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ class Dfs_visitor : public boost::default_dfs_visitor {
void examine_edge(E e, const B_G&) {
auto source = m_graph.source(e), target = m_graph.target(e);
// If the target has not been visited before
if (m_depth[target] == 0 && target != m_roots)
if (m_depth[target] == 0 && target != m_roots) {
m_depth[target] = m_depth[source] + 1;
}

// If the max_depth is reached, mark the target as visited, and push the corresponding edge
if (m_depth[target] == m_max_depth && m_colors[target] != 4) {
Expand Down
2 changes: 1 addition & 1 deletion include/withPoints/withPoints.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include "cpp_common/point_on_edge_t.hpp"
#include "cpp_common/messages.hpp"
#include "cpp_common/basePath_SSEC.hpp"
#include "cpp_common/path.hpp"

namespace pgrouting {

Expand Down
2 changes: 1 addition & 1 deletion include/yen/ksp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include "cpp_common/assert.hpp"
#include "cpp_common/compPaths.hpp"
#include "cpp_common/messages.hpp"
#include "cpp_common/basePath_SSEC.hpp"
#include "cpp_common/path.hpp"

namespace pgrouting {
namespace yen {
Expand Down
2 changes: 1 addition & 1 deletion include/yen/turnRestrictedPath.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include "yen/ksp.hpp"
#include "cpp_common/assert.hpp"
#include "cpp_common/basePath_SSEC.hpp"
#include "cpp_common/path.hpp"
#include "cpp_common/compPaths.hpp"
#include "cpp_common/messages.hpp"
#include "cpp_common/rule.hpp"
Expand Down
24 changes: 20 additions & 4 deletions pgtap/traversal/binaryBreadthFirstSearch/edge_cases/edge_cases.pg
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,18 @@ FROM pgr_binaryBreadthFirstSearch(
);


SELECT throws_ok('errorTestManyWeights',
SELECT
CASE WHEN min_lib_version('4.0.0') THEN
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This checks for the library used

throws_ok('errorTestManyWeights',
'XX000',
'Graph Condition Failed: Graph should have at most two distinct non-negative edge costs! If there are exactly two distinct edge costs, one of them must equal zero!',
'17: Graph has more than 2 distinct weights');
'17: Graph has more than 2 distinct weights')
ELSE
throws_ok('errorTestManyWeights',
'XX000',
'Graph Condition Failed: Graph should have atmost two distinct non-negative edge costs! If there are exactly two distinct edge costs, one of them must equal zero!',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem for update test is that I fixed spelling, atmost -> at most so for library versions before 4.0.0 spelling is still wrong.

'17: Graph has more than 2 distinct weights')
END;

SELECT * INTO edges_invalid_2 FROM edges;
UPDATE edges_invalid_2 SET cost = 2 WHERE cost = 0;
Expand All @@ -98,10 +106,18 @@ FROM pgr_binaryBreadthFirstSearch(
);


SELECT throws_ok('errorTestNoZeroWeight',
SELECT
CASE WHEN min_lib_version('4.0.0') THEN
throws_ok('errorTestNoZeroWeight',
'XX000',
'Graph Condition Failed: Graph should have at most two distinct non-negative edge costs! If there are exactly two distinct edge costs, one of them must equal zero!',
'17: If graph has 2 distinct weights, one must be zero');
'17: If graph has 2 distinct weights, one must be zero')
ELSE
throws_ok('errorTestNoZeroWeight',
'XX000',
'Graph Condition Failed: Graph should have atmost two distinct non-negative edge costs! If there are exactly two distinct edge costs, one of them must equal zero!',
'17: If graph has 2 distinct weights, one must be zero')
END;


SELECT * FROM finish();
Expand Down
2 changes: 1 addition & 1 deletion src/bellman_ford/edwardMoore_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include "cpp_common/combinations.hpp"
#include "cpp_common/pgdata_getters.hpp"
#include "cpp_common/basePath_SSEC.hpp"
#include "cpp_common/path.hpp"
#include "cpp_common/base_graph.hpp"
#include "cpp_common/alloc.hpp"
#include "cpp_common/assert.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/coloring/bipartite_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include "c_types/ii_t_rt.h"
#include "cpp_common/identifiers.hpp"
#include "cpp_common/alloc.hpp"
#include "cpp_common/basePath_SSEC.hpp"
#include "cpp_common/path.hpp"
#include "cpp_common/base_graph.hpp"
#include "drivers/coloring/bipartite_driver.h"
#include "coloring/bipartite_driver.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ADD_LIBRARY(common OBJECT
postgres_connection.c
e_report.c
basePath_SSEC.cpp
path.cpp

check_parameters.c

Expand Down
3 changes: 2 additions & 1 deletion src/common/ch_edge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ CH_edge::add_contracted_vertex(CH_vertex& v) {

void
CH_edge::add_contracted_edge_vertices(CH_edge &e) {
if (e.has_contracted_vertices())
if (e.has_contracted_vertices()) {
m_contracted_vertices += e.contracted_vertices();
}
}

void CH_edge::add_contracted_vertices(Identifiers<int64_t>& ids) {
Expand Down
4 changes: 1 addition & 3 deletions src/common/ch_vertex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ Identifiers<int64_t>&


bool CH_vertex::has_contracted_vertices() const {
if (m_contracted_vertices.size() == 0)
return false;
return true;
return !m_contracted_vertices.empty();
}

void CH_vertex::add_contracted_vertex(CH_vertex& v) {
Expand Down
Loading
Loading