From 8b8957042ba810bd2903cbfe504b52000619916f Mon Sep 17 00:00:00 2001 From: cvvergara Date: Fri, 26 Jan 2024 13:10:58 -0600 Subject: [PATCH] Using boolean instead of enumeration --- include/contraction/pgr_contractionGraph.hpp | 6 ++-- include/cpp_common/pgr_base_graph.hpp | 36 +++++++++---------- include/lineGraph/pgr_lineGraph.hpp | 6 ++-- include/lineGraph/pgr_lineGraphFull.hpp | 6 ++-- src/allpairs/floydWarshall_driver.cpp | 10 +++--- src/allpairs/johnson_driver.cpp | 6 ++-- src/alpha_shape/pgr_alphaShape.cpp | 2 +- src/astar/astar_driver.cpp | 6 ++-- src/bdAstar/bdAstar_driver.cpp | 6 ++-- src/bdDijkstra/bdDijkstra_driver.cpp | 6 ++-- src/bellman_ford/bellman_ford_driver.cpp | 6 ++-- src/bellman_ford/bellman_ford_neg_driver.cpp | 6 ++-- src/bellman_ford/edwardMoore_driver.cpp | 6 ++-- .../binaryBreadthFirstSearch_driver.cpp | 6 ++-- .../breadthFirstSearch_driver.cpp | 6 ++-- src/circuits/hawickCircuits_driver.cpp | 3 +- src/coloring/bipartite_driver.cpp | 3 +- src/coloring/edgeColoring_driver.cpp | 1 - .../sequentialVertexColoring_driver.cpp | 3 +- src/components/articulationPoints_driver.cpp | 4 +-- .../biconnectedComponents_driver.cpp | 5 +-- src/components/bridges_driver.cpp | 5 +-- src/components/connectedComponents_driver.cpp | 4 +-- src/components/makeConnected_driver.cpp | 3 +- src/components/strongComponents_driver.cpp | 6 +--- src/contraction/contractGraph_driver.cpp | 6 ++-- .../dagShortestPath_driver.cpp | 6 ++-- src/dijkstra/dijkstraVia_driver.cpp | 6 ++-- src/dijkstra/dijkstra_driver.cpp | 6 ++-- .../lengauerTarjanDominatorTree_driver.cpp | 3 +- src/driving_distance/drivedist_driver.cpp | 10 +++--- src/driving_distance/withPoints_dd_driver.cpp | 6 ++-- src/ksp/ksp_driver.cpp | 6 ++-- src/ksp/turnRestrictedPath_driver.cpp | 6 ++-- src/ksp/withPoints_ksp_driver.cpp | 12 ++----- src/lineGraph/lineGraphFull_driver.cpp | 4 +-- src/lineGraph/lineGraph_driver.cpp | 4 +-- src/mincut/stoerWagner_driver.cpp | 6 +--- src/ordering/cuthillMckeeOrdering_driver.cpp | 5 +-- src/planar/boyerMyrvold_driver.cpp | 2 +- src/planar/isPlanar_driver.cpp | 4 +-- src/spanningTree/kruskal_driver.cpp | 2 +- src/spanningTree/prim_driver.cpp | 2 +- .../randomSpanningTree_driver.cpp | 6 ++-- .../topologicalSort_driver.cpp | 5 +-- .../transitiveClosure_driver.cpp | 3 +- src/traversal/depthFirstSearch_driver.cpp | 5 ++- src/trsp/trspVia_driver.cpp | 6 ++-- src/trsp/trspVia_withPoints_driver.cpp | 7 ++-- src/trsp/trsp_driver.cpp | 6 ++-- src/trsp/trsp_withPoints_driver.cpp | 6 ++-- src/withPoints/withPointsVia_driver.cpp | 6 ++-- src/withPoints/withPoints_driver.cpp | 6 ++-- 53 files changed, 126 insertions(+), 183 deletions(-) diff --git a/include/contraction/pgr_contractionGraph.hpp b/include/contraction/pgr_contractionGraph.hpp index a71ca8a1d4..56b3e20b33 100644 --- a/include/contraction/pgr_contractionGraph.hpp +++ b/include/contraction/pgr_contractionGraph.hpp @@ -56,10 +56,10 @@ class Pgr_contractionGraph : public Pgr_base_graph { typedef typename boost::graph_traits < G >::in_edge_iterator EI_i; /*! - Prepares the _graph_ to be of type *gtype* + Prepares the _graph_ to be of type *directed* */ - explicit Pgr_contractionGraph(graphType gtype) - : Pgr_base_graph(gtype) { + explicit Pgr_contractionGraph(bool directed) + : Pgr_base_graph(directed) { } /*! @brief get the vertex descriptors of adjacent vertices of *v* diff --git a/include/cpp_common/pgr_base_graph.hpp b/include/cpp_common/pgr_base_graph.hpp index a92019bf2c..0569ffaf81 100644 --- a/include/cpp_common/pgr_base_graph.hpp +++ b/include/cpp_common/pgr_base_graph.hpp @@ -41,8 +41,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. #include #include -#include "cpp_common/graph_enum.hpp" - #include "cpp_common/basic_vertex.hpp" #include "cpp_common/xy_vertex.hpp" #include "cpp_common/basic_edge.hpp" @@ -129,20 +127,20 @@ std::vector< Basic_Vertex > vertices(pgrouting::extract_vertices(my_edges)); There are several ways to initialize the graph ~~~~{.c} // 1. Initializes an empty graph -pgrouting::DirectedGraph digraph(gType); +pgrouting::DirectedGraph digraph(true); // 2. Initializes a graph based on the vertices pgrouting::DirectedGraph digraph( verices, - gType); + true); vertices.clear(); 3. Initializes a graph based on the extracted vertices pgrouting::DirectedGraph digraph( pgrouting::extract_vertices(my_edges, total_edges); - gType); + true); 4. Initializes a graph based on the extracted vertices pgrouting::DirectedGraph digraph( pgrouting::extract_vertices(my_edges); - gType); + true); ~~~~ 1. Initializes an empty graph - vertices vector size is 0 @@ -262,7 +260,7 @@ class Pgr_base_graph { //! @name The Graph //@{ G graph; //!< The graph - graphType m_gType; //!< type (DIRECTED or UNDIRECTED) + bool m_is_directed; //!< type (DIRECTED or UNDIRECTED) //@} //! @name Id mapping handling @@ -297,12 +295,12 @@ class Pgr_base_graph { - The vertices must be checked (if necessary) before calling the constructor */ Pgr_base_graph< G , T_V, T_E >( - const std::vector< T_V > &vertices, graphType gtype) + const std::vector< T_V > &vertices, bool directed) : graph(vertices.size()), #if 0 m_num_vertices(vertices.size()), #endif - m_gType(gtype), + m_is_directed(directed), vertIndex(boost::get(boost::vertex_index, graph)), propmapIndex(mapIndex) { // add_vertices(vertices); @@ -339,12 +337,12 @@ class Pgr_base_graph { /*! Prepares the _graph_ to be of type gtype with 0 vertices */ - explicit Pgr_base_graph< G , T_V, T_E >(graphType gtype) + explicit Pgr_base_graph< G , T_V, T_E >(bool directed) : graph(0), #if 0 m_num_vertices(0), #endif - m_gType(gtype), + m_is_directed(directed), vertIndex(boost::get(boost::vertex_index, graph)), propmapIndex(mapIndex) { } @@ -552,8 +550,8 @@ class Pgr_base_graph { //! @name to be or not to be //@{ - bool is_directed() const {return m_gType == DIRECTED;} - bool is_undirected() const {return m_gType == UNDIRECTED;} + bool is_directed() const {return m_is_directed;} + bool is_undirected() const {return !m_is_directed;} bool is_source(V v_idx, E e_idx) const {return v_idx == source(e_idx);} bool is_target(V v_idx, E e_idx) const {return v_idx == target(e_idx);} @@ -857,7 +855,7 @@ Pgr_base_graph< G, T_V, T_E >::disconnect_vertex(V vertex) { } // special case - if (m_gType == DIRECTED) { + if (m_is_directed) { EI_i in, in_end; for (boost::tie(in, in_end) = in_edges(vertex, graph); in != in_end; ++in) { @@ -968,8 +966,7 @@ Pgr_base_graph< G, T_V, T_E >::graph_add_edge(const T &edge, bool normal) { } if (edge.reverse_cost >= 0 - && (m_gType == DIRECTED - || (m_gType == UNDIRECTED && edge.cost != edge.reverse_cost))) { + && (m_is_directed || (!m_is_directed && edge.cost != edge.reverse_cost))) { boost::tie(e, inserted) = boost::add_edge(vm_t, vm_s, graph); @@ -1014,8 +1011,7 @@ Pgr_base_graph< G, T_V, T_E >::graph_add_min_edge_no_parallel(const T &edge) { } if (edge.reverse_cost >= 0 - && (m_gType == DIRECTED - || (m_gType == UNDIRECTED && edge.cost != edge.reverse_cost))) { + && (m_is_directed || (!m_is_directed && edge.cost != edge.reverse_cost))) { E e1; bool found; boost::tie(e1, found) = boost::edge(vm_t, vm_s, graph); @@ -1064,8 +1060,8 @@ Pgr_base_graph< G, T_V, T_E >::graph_add_neg_edge(const T &edge, bool normal) { } graph[e].id = edge.id; - if (m_gType == DIRECTED - || (m_gType == UNDIRECTED && edge.cost > edge.reverse_cost)) { + if (m_is_directed + || (!m_is_directed && edge.cost > edge.reverse_cost)) { boost::tie(e, inserted) = boost::add_edge(vm_t, vm_s, graph); if (edge.reverse_cost < 0) { diff --git a/include/lineGraph/pgr_lineGraph.hpp b/include/lineGraph/pgr_lineGraph.hpp index 4352fc3e50..d0c1a6e187 100644 --- a/include/lineGraph/pgr_lineGraph.hpp +++ b/include/lineGraph/pgr_lineGraph.hpp @@ -56,12 +56,12 @@ class Pgr_lineGraph : public Pgr_base_graph { typedef typename boost::graph_traits < G >::in_edge_iterator EI_i; - explicit Pgr_lineGraph< G, T_V, T_E >(graphType gtype) - : Pgr_base_graph< G, T_V, T_E >(gtype) { + explicit Pgr_lineGraph< G, T_V, T_E >(bool directed) + : Pgr_base_graph< G, T_V, T_E >(directed) { } explicit Pgr_lineGraph< G, T_V, T_E >(const pgrouting::DirectedGraph &digraph) - : Pgr_base_graph< G, T_V, T_E >(graphType::DIRECTED) { + : Pgr_base_graph< G, T_V, T_E >(true) { insert_vertices(digraph); create_edges(digraph); } diff --git a/include/lineGraph/pgr_lineGraphFull.hpp b/include/lineGraph/pgr_lineGraphFull.hpp index 3cb55e9d57..c782aa4ca4 100644 --- a/include/lineGraph/pgr_lineGraphFull.hpp +++ b/include/lineGraph/pgr_lineGraphFull.hpp @@ -55,13 +55,13 @@ class Pgr_lineGraphFull : public Pgr_base_graph { typedef typename boost::graph_traits < G >::in_edge_iterator EI_i; - explicit Pgr_lineGraphFull< G, T_V, T_E >(const graphType >ype) - : Pgr_base_graph< G, T_V, T_E >(gtype), + explicit Pgr_lineGraphFull< G, T_V, T_E >(bool directed) + : Pgr_base_graph< G, T_V, T_E >(directed), m_num_edges(0) { } explicit Pgr_lineGraphFull< G, T_V, T_E >(const pgrouting::DirectedGraph &digraph) - : Pgr_base_graph< G, T_V, T_E >(graphType::DIRECTED) { + : Pgr_base_graph< G, T_V, T_E >(true) { apply_transformation(digraph); store_edge_costs(digraph); } diff --git a/src/allpairs/floydWarshall_driver.cpp b/src/allpairs/floydWarshall_driver.cpp index 0dc5cfb4c1..f43f3ad454 100644 --- a/src/allpairs/floydWarshall_driver.cpp +++ b/src/allpairs/floydWarshall_driver.cpp @@ -43,7 +43,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. void pgr_do_floydWarshall( char *edges_sql, - bool directedFlag, + bool directed, IID_t_rt **return_tuples, size_t *return_count, @@ -62,8 +62,6 @@ pgr_do_floydWarshall( pgassert(!(*return_tuples)); pgassert(*return_count == 0); - graphType gType = directedFlag? DIRECTED: UNDIRECTED; - hint = edges_sql; auto edges = pgrouting::pgget::get_edges(std::string(edges_sql), true, true); @@ -72,14 +70,14 @@ pgr_do_floydWarshall( } hint = nullptr; - if (directedFlag) { + if (directed) { log << "Processing Directed graph\n"; - pgrouting::DirectedGraph digraph(gType); + pgrouting::DirectedGraph digraph(directed); digraph.insert_edges(edges); pgr_floydWarshall(digraph, *return_count, return_tuples); } else { log << "Processing Undirected graph\n"; - pgrouting::UndirectedGraph undigraph(gType); + pgrouting::UndirectedGraph undigraph(directed); undigraph.insert_edges(edges); pgr_floydWarshall(undigraph, *return_count, return_tuples); } diff --git a/src/allpairs/johnson_driver.cpp b/src/allpairs/johnson_driver.cpp index 030a5e1dd3..d9b3070116 100644 --- a/src/allpairs/johnson_driver.cpp +++ b/src/allpairs/johnson_driver.cpp @@ -61,8 +61,6 @@ pgr_do_johnson( pgassert(!(*return_tuples)); pgassert(*return_count == 0); - graphType gType = directed? DIRECTED: UNDIRECTED; - hint = edges_sql; auto edges = pgrouting::pgget::get_edges(std::string(edges_sql), true, true); @@ -73,12 +71,12 @@ pgr_do_johnson( if (directed) { log << "Processing Directed graph\n"; - pgrouting::DirectedGraph digraph(gType); + pgrouting::DirectedGraph digraph(directed); digraph.insert_edges(edges); pgr_johnson(digraph, *return_count, return_tuples); } else { log << "Processing Undirected graph\n"; - pgrouting::UndirectedGraph undigraph(gType); + pgrouting::UndirectedGraph undigraph(directed); undigraph.insert_edges(edges); pgr_johnson(undigraph, *return_count, return_tuples); } diff --git a/src/alpha_shape/pgr_alphaShape.cpp b/src/alpha_shape/pgr_alphaShape.cpp index c9558424d4..925ea0cc4a 100644 --- a/src/alpha_shape/pgr_alphaShape.cpp +++ b/src/alpha_shape/pgr_alphaShape.cpp @@ -166,7 +166,7 @@ struct CompareRadius { * Constructor */ Pgr_alphaShape::Pgr_alphaShape(const std::vector &edges) : -graph(UNDIRECTED) { +graph(false) { graph.insert_edges(edges); make_triangles(); } diff --git a/src/astar/astar_driver.cpp b/src/astar/astar_driver.cpp index e4ac970a43..183760495c 100644 --- a/src/astar/astar_driver.cpp +++ b/src/astar/astar_driver.cpp @@ -102,15 +102,15 @@ void pgr_do_astar( } - graphType gType = directed? DIRECTED: UNDIRECTED; + std::deque paths; if (directed) { - pgrouting::xyDirectedGraph graph(gType); + pgrouting::xyDirectedGraph graph(directed); graph.insert_edges(edges); paths = pgrouting::algorithms::astar(graph, combinations, heuristic, factor, epsilon, only_cost); } else { - pgrouting::xyUndirectedGraph graph(gType); + pgrouting::xyUndirectedGraph graph(directed); graph.insert_edges(edges); paths = pgrouting::algorithms::astar(graph, combinations, heuristic, factor, epsilon, only_cost); } diff --git a/src/bdAstar/bdAstar_driver.cpp b/src/bdAstar/bdAstar_driver.cpp index 456c91e2fa..4b8745f2e0 100644 --- a/src/bdAstar/bdAstar_driver.cpp +++ b/src/bdAstar/bdAstar_driver.cpp @@ -98,15 +98,15 @@ void pgr_do_bdAstar( } hint = nullptr; - graphType gType = directed? DIRECTED: UNDIRECTED; + std::deque paths; if (directed) { - pgrouting::xyDirectedGraph graph(gType); + pgrouting::xyDirectedGraph graph(directed); graph.insert_edges(edges); paths = pgrouting::algorithms::bdastar(graph, combinations, heuristic, factor, epsilon, only_cost); } else { - pgrouting::xyUndirectedGraph graph(gType); + pgrouting::xyUndirectedGraph graph(directed); graph.insert_edges(edges); paths = pgrouting::algorithms::bdastar(graph, combinations, heuristic, factor, epsilon, only_cost); } diff --git a/src/bdDijkstra/bdDijkstra_driver.cpp b/src/bdDijkstra/bdDijkstra_driver.cpp index 4d8ed79830..30aa75d2cd 100644 --- a/src/bdDijkstra/bdDijkstra_driver.cpp +++ b/src/bdDijkstra/bdDijkstra_driver.cpp @@ -121,7 +121,7 @@ pgr_do_bdDijkstra( return; } - graphType gType = directed? DIRECTED: UNDIRECTED; + hint = edges_sql; auto edges = pgrouting::pgget::get_edges(std::string(edges_sql), true, false); @@ -136,11 +136,11 @@ pgr_do_bdDijkstra( std::deque paths; if (directed) { - pgrouting::DirectedGraph graph(gType); + pgrouting::DirectedGraph graph(directed); graph.insert_edges(edges); paths = pgr_bdDijkstra(graph, combinations, only_cost); } else { - pgrouting::UndirectedGraph graph(gType); + pgrouting::UndirectedGraph graph(directed); graph.insert_edges(edges); paths = pgr_bdDijkstra(graph, combinations, only_cost); } diff --git a/src/bellman_ford/bellman_ford_driver.cpp b/src/bellman_ford/bellman_ford_driver.cpp index 0baf0a191c..4775089e48 100644 --- a/src/bellman_ford/bellman_ford_driver.cpp +++ b/src/bellman_ford/bellman_ford_driver.cpp @@ -127,7 +127,7 @@ pgr_do_bellman_ford( pgassert(!(*return_tuples)); pgassert(*return_count == 0); - graphType gType = directed? DIRECTED: UNDIRECTED; + hint = combinations_sql; auto combinations = get_combinations(combinations_sql, starts, ends, true); @@ -151,11 +151,11 @@ pgr_do_bellman_ford( std::deque paths; if (directed) { - pgrouting::DirectedGraph digraph(gType); + pgrouting::DirectedGraph digraph(directed); digraph.insert_edges(edges); paths = bellman_ford(digraph, combinations, only_cost); } else { - pgrouting::UndirectedGraph undigraph(gType); + pgrouting::UndirectedGraph undigraph(directed); undigraph.insert_edges(edges); paths = bellman_ford(undigraph, combinations, only_cost); } diff --git a/src/bellman_ford/bellman_ford_neg_driver.cpp b/src/bellman_ford/bellman_ford_neg_driver.cpp index c2d752dec1..9b97b980bf 100644 --- a/src/bellman_ford/bellman_ford_neg_driver.cpp +++ b/src/bellman_ford/bellman_ford_neg_driver.cpp @@ -125,7 +125,7 @@ pgr_do_bellman_ford_neg( pgassert(!(*return_tuples)); pgassert(*return_count == 0); - graphType gType = directed? DIRECTED: UNDIRECTED; + hint = combinations_sql; auto combinations = get_combinations(combinations_sql, starts, ends, normal); @@ -154,12 +154,12 @@ pgr_do_bellman_ford_neg( std::deque paths; if (directed) { - pgrouting::DirectedGraph digraph(gType); + pgrouting::DirectedGraph digraph(directed); digraph.insert_edges(edges); digraph.insert_negative_edges(neg_edges); paths = bellman_ford(digraph, combinations, only_cost); } else { - pgrouting::UndirectedGraph undigraph(gType); + pgrouting::UndirectedGraph undigraph(directed); undigraph.insert_edges(edges); undigraph.insert_negative_edges(neg_edges); paths = pgr_bellman_ford(undigraph, combinations, only_cost); diff --git a/src/bellman_ford/edwardMoore_driver.cpp b/src/bellman_ford/edwardMoore_driver.cpp index 9780a0e730..3b8e55e8c9 100644 --- a/src/bellman_ford/edwardMoore_driver.cpp +++ b/src/bellman_ford/edwardMoore_driver.cpp @@ -122,7 +122,7 @@ pgr_do_edwardMoore( pgassert(!(*return_tuples)); pgassert(*return_count == 0); - graphType gType = directed? DIRECTED: UNDIRECTED; + hint = combinations_sql; auto combinations = get_combinations(combinations_sql, starts, ends, true); @@ -146,11 +146,11 @@ pgr_do_edwardMoore( std::deque paths; if (directed) { - pgrouting::DirectedGraph digraph(gType); + pgrouting::DirectedGraph digraph(directed); digraph.insert_edges(edges); paths = edwardMoore(digraph, combinations); } else { - pgrouting::UndirectedGraph undigraph(gType); + pgrouting::UndirectedGraph undigraph(directed); undigraph.insert_edges(edges); paths = edwardMoore(undigraph, combinations); } diff --git a/src/breadthFirstSearch/binaryBreadthFirstSearch_driver.cpp b/src/breadthFirstSearch/binaryBreadthFirstSearch_driver.cpp index edb5a302ee..a088917ccb 100644 --- a/src/breadthFirstSearch/binaryBreadthFirstSearch_driver.cpp +++ b/src/breadthFirstSearch/binaryBreadthFirstSearch_driver.cpp @@ -155,7 +155,7 @@ pgr_do_binaryBreadthFirstSearch( pgassert(!(*return_tuples)); pgassert(*return_count == 0); - graphType gType = directed? DIRECTED: UNDIRECTED; + hint = combinations_sql; auto combinations = get_combinations(combinations_sql, starts, ends, true); @@ -179,7 +179,7 @@ pgr_do_binaryBreadthFirstSearch( std::deque< Path >paths; if (directed) { - pgrouting::DirectedGraph digraph(gType); + pgrouting::DirectedGraph digraph(directed); digraph.insert_edges(edges); if (!(costCheck(digraph))) { @@ -190,7 +190,7 @@ pgr_do_binaryBreadthFirstSearch( paths = binaryBreadthFirstSearch(digraph, combinations); } else { - pgrouting::UndirectedGraph undigraph(gType); + pgrouting::UndirectedGraph undigraph(directed); undigraph.insert_edges(edges); if (!(costCheck(undigraph))) { diff --git a/src/breadthFirstSearch/breadthFirstSearch_driver.cpp b/src/breadthFirstSearch/breadthFirstSearch_driver.cpp index abddfad544..18dc938de6 100644 --- a/src/breadthFirstSearch/breadthFirstSearch_driver.cpp +++ b/src/breadthFirstSearch/breadthFirstSearch_driver.cpp @@ -102,7 +102,7 @@ pgr_do_breadthFirstSearch( pgassert(!(*return_tuples)); pgassert(*return_count == 0); - graphType gType = directed? DIRECTED: UNDIRECTED; + hint = edges_sql; auto edges = pgrouting::pgget::get_edges(std::string(edges_sql), true, false); @@ -118,12 +118,12 @@ pgr_do_breadthFirstSearch( std::vector results; if (directed) { - pgrouting::DirectedGraph digraph(gType); + pgrouting::DirectedGraph digraph(directed); digraph.insert_edges(edges); results = breadthFirstSearch(digraph, roots, max_depth); } else { - pgrouting::UndirectedGraph undigraph(gType); + pgrouting::UndirectedGraph undigraph(directed); undigraph.insert_edges(edges); results = breadthFirstSearch(undigraph, roots, max_depth); } diff --git a/src/circuits/hawickCircuits_driver.cpp b/src/circuits/hawickCircuits_driver.cpp index 997dc58e6a..6af9c0413c 100644 --- a/src/circuits/hawickCircuits_driver.cpp +++ b/src/circuits/hawickCircuits_driver.cpp @@ -96,8 +96,7 @@ pgr_do_hawickCircuits( std::deque results; - graphType gType = DIRECTED; - pgrouting::DirectedGraph digraph(gType); + pgrouting::DirectedGraph digraph(true); digraph.insert_edges(edges); results = pgr_hawickCircuits(digraph); diff --git a/src/coloring/bipartite_driver.cpp b/src/coloring/bipartite_driver.cpp index 3d80b8b734..5b09db02a2 100644 --- a/src/coloring/bipartite_driver.cpp +++ b/src/coloring/bipartite_driver.cpp @@ -79,8 +79,7 @@ pgr_do_bipartite( hint = nullptr; std::string logstr; - graphType gType = UNDIRECTED; - pgrouting::UndirectedGraph undigraph(gType); + pgrouting::UndirectedGraph undigraph(false); undigraph.insert_edges(edges); std::vector results; pgrouting::functions::Pgr_Bipartite fn_Bipartite; diff --git a/src/coloring/edgeColoring_driver.cpp b/src/coloring/edgeColoring_driver.cpp index b75be666a7..0172463296 100644 --- a/src/coloring/edgeColoring_driver.cpp +++ b/src/coloring/edgeColoring_driver.cpp @@ -34,7 +34,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. #include "coloring/pgr_edgeColoring.hpp" #include "cpp_common/pgdata_getters.hpp" -#include "cpp_common/graph_enum.hpp" #include "cpp_common/pgr_alloc.hpp" #include "cpp_common/pgr_assert.hpp" diff --git a/src/coloring/sequentialVertexColoring_driver.cpp b/src/coloring/sequentialVertexColoring_driver.cpp index ced0b5f49c..96edde0543 100644 --- a/src/coloring/sequentialVertexColoring_driver.cpp +++ b/src/coloring/sequentialVertexColoring_driver.cpp @@ -91,8 +91,7 @@ pgr_do_sequentialVertexColoring( std::vector results; - graphType gType = UNDIRECTED; - pgrouting::UndirectedGraph undigraph(gType); + pgrouting::UndirectedGraph undigraph(false); undigraph.insert_edges(edges); diff --git a/src/components/articulationPoints_driver.cpp b/src/components/articulationPoints_driver.cpp index b7edb4beab..a6ed877cac 100644 --- a/src/components/articulationPoints_driver.cpp +++ b/src/components/articulationPoints_driver.cpp @@ -77,9 +77,7 @@ pgr_do_articulationPoints( } hint = nullptr; - graphType gType = UNDIRECTED; - - pgrouting::UndirectedGraph undigraph(gType); + pgrouting::UndirectedGraph undigraph(false); undigraph.insert_edges(edges); auto results(pgrouting::algorithms::articulationPoints(undigraph)); diff --git a/src/components/biconnectedComponents_driver.cpp b/src/components/biconnectedComponents_driver.cpp index 8e36ec4d23..117d2d7e3c 100644 --- a/src/components/biconnectedComponents_driver.cpp +++ b/src/components/biconnectedComponents_driver.cpp @@ -78,10 +78,7 @@ pgr_do_biconnectedComponents( } hint = nullptr; - graphType gType = UNDIRECTED; - - log << "Working with Undirected Graph\n"; - pgrouting::UndirectedGraph undigraph(gType); + pgrouting::UndirectedGraph undigraph(false); undigraph.insert_edges(edges); auto results(pgrouting::algorithms::biconnectedComponents(undigraph)); diff --git a/src/components/bridges_driver.cpp b/src/components/bridges_driver.cpp index 89100976b4..1538e8f808 100644 --- a/src/components/bridges_driver.cpp +++ b/src/components/bridges_driver.cpp @@ -76,10 +76,7 @@ pgr_do_bridges( } hint = nullptr; - graphType gType = UNDIRECTED; - - - pgrouting::UndirectedGraph undigraph(gType); + pgrouting::UndirectedGraph undigraph(false); undigraph.insert_edges(edges); auto results = pgrouting::algorithms::bridges(undigraph); diff --git a/src/components/connectedComponents_driver.cpp b/src/components/connectedComponents_driver.cpp index 95ab270593..79d5623857 100644 --- a/src/components/connectedComponents_driver.cpp +++ b/src/components/connectedComponents_driver.cpp @@ -77,9 +77,7 @@ pgr_do_connectedComponents( } hint = nullptr; - graphType gType = UNDIRECTED; - - pgrouting::UndirectedGraph undigraph(gType); + pgrouting::UndirectedGraph undigraph(false); undigraph.insert_edges(edges); auto results(pgrouting::algorithms::pgr_connectedComponents(undigraph)); diff --git a/src/components/makeConnected_driver.cpp b/src/components/makeConnected_driver.cpp index 6155997daf..27712ef043 100644 --- a/src/components/makeConnected_driver.cpp +++ b/src/components/makeConnected_driver.cpp @@ -79,8 +79,7 @@ pgr_do_makeConnected( } hint = nullptr; - graphType gType = UNDIRECTED; - pgrouting::UndirectedGraph undigraph(gType); + pgrouting::UndirectedGraph undigraph(false); undigraph.insert_edges(edges); pgrouting::functions::Pgr_makeConnected fn_makeConnected; results = fn_makeConnected.makeConnected(undigraph); diff --git a/src/components/strongComponents_driver.cpp b/src/components/strongComponents_driver.cpp index 0d8b0ab13f..7e42dd83c0 100644 --- a/src/components/strongComponents_driver.cpp +++ b/src/components/strongComponents_driver.cpp @@ -69,8 +69,6 @@ pgr_do_strongComponents( pgassert(!(*return_tuples)); pgassert(*return_count == 0); - graphType gType = DIRECTED; - hint = edges_sql; auto edges = get_edges(std::string(edges_sql), true, false); if (edges.empty()) { @@ -80,9 +78,7 @@ pgr_do_strongComponents( } hint = nullptr; - - - pgrouting::DirectedGraph digraph(gType); + pgrouting::DirectedGraph digraph(true); digraph.insert_edges(edges); auto results(pgrouting::algorithms::strongComponents(digraph)); diff --git a/src/contraction/contractGraph_driver.cpp b/src/contraction/contractGraph_driver.cpp index 6488f0dc33..b11ed1fd8f 100644 --- a/src/contraction/contractGraph_driver.cpp +++ b/src/contraction/contractGraph_driver.cpp @@ -224,10 +224,10 @@ pgr_do_contractGraph( } - graphType gType = directed? DIRECTED: UNDIRECTED; + if (directed) { using DirectedGraph = pgrouting::graph::CHDirectedGraph; - DirectedGraph digraph(gType); + DirectedGraph digraph(directed); process_contraction(digraph, edges, forbid, ordering, max_cycles); @@ -238,7 +238,7 @@ pgr_do_contractGraph( return_count); } else { using UndirectedGraph = pgrouting::graph::CHUndirectedGraph; - UndirectedGraph undigraph(gType); + UndirectedGraph undigraph(directed); process_contraction(undigraph, edges, forbid, ordering, max_cycles); diff --git a/src/dagShortestPath/dagShortestPath_driver.cpp b/src/dagShortestPath/dagShortestPath_driver.cpp index 4195e37932..235d34fc35 100644 --- a/src/dagShortestPath/dagShortestPath_driver.cpp +++ b/src/dagShortestPath/dagShortestPath_driver.cpp @@ -105,7 +105,7 @@ pgr_do_dagShortestPath( return; } - graphType gType = directed? DIRECTED: UNDIRECTED; + hint = edges_sql; auto edges = get_edges(std::string(edges_sql), true, false); @@ -119,11 +119,11 @@ pgr_do_dagShortestPath( std::deque paths; if (directed) { - pgrouting::DirectedGraph graph(gType); + pgrouting::DirectedGraph graph(directed); graph.insert_edges(edges); paths = pgr_dagShortestPath(graph, combinations, only_cost); } else { - pgrouting::UndirectedGraph graph(gType); + pgrouting::UndirectedGraph graph(directed); graph.insert_edges(edges); paths = pgr_dagShortestPath(graph, combinations, only_cost); } diff --git a/src/dijkstra/dijkstraVia_driver.cpp b/src/dijkstra/dijkstraVia_driver.cpp index 92d5f48116..636e29bb6e 100644 --- a/src/dijkstra/dijkstraVia_driver.cpp +++ b/src/dijkstra/dijkstraVia_driver.cpp @@ -120,7 +120,7 @@ pgr_do_dijkstraVia( pgassert(!(*return_tuples)); pgassert(*return_count == 0); - graphType gType = directed? DIRECTED: UNDIRECTED; + auto via = get_intArray(viaArr, false); @@ -136,7 +136,7 @@ pgr_do_dijkstraVia( std::dequepaths; if (directed) { - pgrouting::DirectedGraph digraph(gType); + pgrouting::DirectedGraph digraph(directed); digraph.insert_edges(edges); pgrouting::pgr_dijkstraVia( digraph, @@ -146,7 +146,7 @@ pgr_do_dijkstraVia( U_turn_on_edge, log); } else { - pgrouting::UndirectedGraph undigraph(gType); + pgrouting::UndirectedGraph undigraph(directed); undigraph.insert_edges(edges); pgrouting::pgr_dijkstraVia( undigraph, diff --git a/src/dijkstra/dijkstra_driver.cpp b/src/dijkstra/dijkstra_driver.cpp index b7bff39d02..cf2ff256eb 100644 --- a/src/dijkstra/dijkstra_driver.cpp +++ b/src/dijkstra/dijkstra_driver.cpp @@ -149,7 +149,7 @@ pgr_do_dijkstra( return; } - graphType gType = directed? DIRECTED: UNDIRECTED; + hint = edges_sql; auto edges = get_edges(std::string(edges_sql), normal, false); @@ -165,11 +165,11 @@ pgr_do_dijkstra( std::dequepaths; if (directed) { - pgrouting::DirectedGraph graph(gType); + pgrouting::DirectedGraph graph(directed); graph.insert_edges(edges); paths = pgrouting::algorithms::dijkstra(graph, combinations, only_cost, n); } else { - pgrouting::UndirectedGraph graph(gType); + pgrouting::UndirectedGraph graph(directed); graph.insert_edges(edges); paths = pgrouting::algorithms::dijkstra(graph, combinations, only_cost, n); } diff --git a/src/dominator/lengauerTarjanDominatorTree_driver.cpp b/src/dominator/lengauerTarjanDominatorTree_driver.cpp index 6433e25620..1538a25ec2 100644 --- a/src/dominator/lengauerTarjanDominatorTree_driver.cpp +++ b/src/dominator/lengauerTarjanDominatorTree_driver.cpp @@ -82,8 +82,7 @@ pgr_do_LTDTree( std::string logstr; - graphType gType = DIRECTED; - pgrouting::DirectedGraph digraph(gType); + pgrouting::DirectedGraph digraph(true); digraph.insert_edges(edges); std::vector results; pgrouting::functions::Pgr_LTDTree fn_LTDTree; diff --git a/src/driving_distance/drivedist_driver.cpp b/src/driving_distance/drivedist_driver.cpp index 0b63fc2f46..c34728880a 100644 --- a/src/driving_distance/drivedist_driver.cpp +++ b/src/driving_distance/drivedist_driver.cpp @@ -48,7 +48,7 @@ pgr_do_drivingDistance( char *edges_sql, ArrayType* starts, double distance, - bool directedFlag, + bool directed, bool equiCostFlag, MST_rt **return_tuples, size_t *return_count, char **log_msg, @@ -86,17 +86,15 @@ pgr_do_drivingDistance( } hint = nullptr; - graphType gType = directedFlag? DIRECTED: UNDIRECTED; - std::deque paths; std::vector> depths; - if (directedFlag) { - pgrouting::DirectedGraph digraph(gType); + if (directed) { + pgrouting::DirectedGraph digraph(directed); digraph.insert_edges(edges); paths = drivingDistance(digraph, roots, distance, equiCostFlag, depths, true); } else { - pgrouting::UndirectedGraph undigraph(gType); + pgrouting::UndirectedGraph undigraph(directed); undigraph.insert_edges(edges); paths = drivingDistance(undigraph, roots, distance, equiCostFlag, depths, true); } diff --git a/src/driving_distance/withPoints_dd_driver.cpp b/src/driving_distance/withPoints_dd_driver.cpp index 883f77348f..dc68f8689c 100644 --- a/src/driving_distance/withPoints_dd_driver.cpp +++ b/src/driving_distance/withPoints_dd_driver.cpp @@ -119,18 +119,18 @@ pgr_do_withPointsDD( return; } - graphType gType = directed? DIRECTED: UNDIRECTED; + std::deque paths; std::vector> depths; if (directed) { - pgrouting::DirectedGraph digraph(gType); + pgrouting::DirectedGraph digraph(directed); digraph.insert_edges(edges); digraph.insert_edges(pg_graph.new_edges()); paths = drivingDistance(digraph, roots, distance, equiCost, depths, details); } else { - pgrouting::UndirectedGraph undigraph(gType); + pgrouting::UndirectedGraph undigraph(directed); undigraph.insert_edges(edges); undigraph.insert_edges(pg_graph.new_edges()); paths = drivingDistance(undigraph, roots, distance, equiCost, depths, details); diff --git a/src/ksp/ksp_driver.cpp b/src/ksp/ksp_driver.cpp index 4599d1aaa0..63cd97539c 100644 --- a/src/ksp/ksp_driver.cpp +++ b/src/ksp/ksp_driver.cpp @@ -81,7 +81,7 @@ void pgr_do_ksp( pgassert(!(*return_tuples)); pgassert(*return_count == 0); - graphType gType = directed? DIRECTED: UNDIRECTED; + hint = combinations_sql; auto combinations = get_combinations(combinations_sql, starts, ends, true); @@ -110,11 +110,11 @@ void pgr_do_ksp( std::dequepaths; if (directed) { - pgrouting::DirectedGraph graph(gType); + pgrouting::DirectedGraph graph(directed); graph.insert_edges(edges); paths = pgrouting::algorithms::Yen(graph, combinations, k, heap_paths); } else { - pgrouting::UndirectedGraph graph(gType); + pgrouting::UndirectedGraph graph(directed); graph.insert_edges(edges); paths = pgrouting::algorithms::Yen(graph, combinations, k, heap_paths); } diff --git a/src/ksp/turnRestrictedPath_driver.cpp b/src/ksp/turnRestrictedPath_driver.cpp index 9c6ffd746b..8d64c4aa68 100644 --- a/src/ksp/turnRestrictedPath_driver.cpp +++ b/src/ksp/turnRestrictedPath_driver.cpp @@ -117,7 +117,7 @@ pgr_do_turnRestrictedPath( pgassert(!(*return_tuples)); pgassert(*return_count == 0); - graphType gType = directed? DIRECTED: UNDIRECTED; + hint = edges_sql; auto edges = get_edges(std::string(edges_sql), true, false); @@ -145,7 +145,7 @@ pgr_do_turnRestrictedPath( std::string logstr; if (directed) { log << "Working with directed Graph\n"; - pgrouting::DirectedGraph digraph(gType); + pgrouting::DirectedGraph digraph(directed); Pgr_turnRestrictedPath < pgrouting::DirectedGraph > fn_TRSP; digraph.insert_edges(edges); log << digraph; @@ -162,7 +162,7 @@ pgr_do_turnRestrictedPath( strict); } else { log << "TODO Working with Undirected Graph\n"; - pgrouting::UndirectedGraph undigraph(gType); + pgrouting::UndirectedGraph undigraph(directed); Pgr_turnRestrictedPath < pgrouting::UndirectedGraph > fn_TRSP; undigraph.insert_edges(edges); paths = pgr_dijkstraTR(undigraph, diff --git a/src/ksp/withPoints_ksp_driver.cpp b/src/ksp/withPoints_ksp_driver.cpp index 4ac9eab0b9..1943312f1d 100644 --- a/src/ksp/withPoints_ksp_driver.cpp +++ b/src/ksp/withPoints_ksp_driver.cpp @@ -135,23 +135,15 @@ pgr_do_withPointsKsp( return; } - - graphType gType = directed? DIRECTED: UNDIRECTED; - std::deque paths; - - auto vertices(pgrouting::extract_vertices(edges)); - vertices = pgrouting::extract_vertices(vertices, pg_graph.new_edges()); - - if (directed) { - pgrouting::DirectedGraph digraph(vertices, gType); + pgrouting::DirectedGraph digraph(directed); digraph.insert_edges(edges); digraph.insert_edges(pg_graph.new_edges()); paths = pgrouting::algorithms::Yen(digraph, combinations, k, heap_paths); } else { - pgrouting::UndirectedGraph undigraph(gType); + pgrouting::UndirectedGraph undigraph(directed); undigraph.insert_edges(edges); undigraph.insert_edges(pg_graph.new_edges()); diff --git a/src/lineGraph/lineGraphFull_driver.cpp b/src/lineGraph/lineGraphFull_driver.cpp index 9f71e71ad5..018ef48a9f 100644 --- a/src/lineGraph/lineGraphFull_driver.cpp +++ b/src/lineGraph/lineGraphFull_driver.cpp @@ -99,9 +99,7 @@ pgr_do_lineGraphFull( } hint = nullptr; - graphType gType = DIRECTED; - - pgrouting::DirectedGraph digraph(gType); + pgrouting::DirectedGraph digraph(true); digraph.insert_edges_neg(edges); pgrouting::graph::Pgr_lineGraphFull< diff --git a/src/lineGraph/lineGraph_driver.cpp b/src/lineGraph/lineGraph_driver.cpp index d645034428..730173bf6d 100644 --- a/src/lineGraph/lineGraph_driver.cpp +++ b/src/lineGraph/lineGraph_driver.cpp @@ -95,9 +95,9 @@ pgr_do_lineGraph( } hint = nullptr; - graphType gType = directed? DIRECTED: UNDIRECTED; - pgrouting::DirectedGraph digraph(gType); + + pgrouting::DirectedGraph digraph(directed); digraph.insert_edges_neg(edges); log << digraph << "\n"; diff --git a/src/mincut/stoerWagner_driver.cpp b/src/mincut/stoerWagner_driver.cpp index ef933899da..df66e189ed 100644 --- a/src/mincut/stoerWagner_driver.cpp +++ b/src/mincut/stoerWagner_driver.cpp @@ -85,13 +85,9 @@ pgr_do_stoerWagner( } hint = nullptr; - graphType gType = UNDIRECTED; - std::vector results; - log << "Working with Undirected Graph\n"; - - pgrouting::UndirectedGraph undigraph(gType); + pgrouting::UndirectedGraph undigraph(false); undigraph.insert_edges(edges); results = pgr_stoerWagner( undigraph); diff --git a/src/ordering/cuthillMckeeOrdering_driver.cpp b/src/ordering/cuthillMckeeOrdering_driver.cpp index d298934e9d..d74331a8b6 100644 --- a/src/ordering/cuthillMckeeOrdering_driver.cpp +++ b/src/ordering/cuthillMckeeOrdering_driver.cpp @@ -103,11 +103,8 @@ void pgr_do_cuthillMckeeOrdering( } hint = nullptr; - graphType gType = UNDIRECTED; - std::vectorresults; - - pgrouting::UndirectedGraph undigraph(gType); + pgrouting::UndirectedGraph undigraph(false); undigraph.insert_edges(edges); results = cuthillMckeeOrdering(undigraph); diff --git a/src/planar/boyerMyrvold_driver.cpp b/src/planar/boyerMyrvold_driver.cpp index 9c7f5e2dd9..dea82dfb12 100644 --- a/src/planar/boyerMyrvold_driver.cpp +++ b/src/planar/boyerMyrvold_driver.cpp @@ -82,7 +82,7 @@ pgr_do_boyerMyrvold( hint = nullptr; log << "Working with Undirected Graph\n"; - pgrouting::UndirectedGraph undigraph(gType); + pgrouting::UndirectedGraph undigraph(directed); undigraph.insert_edges(edges); pgrouting::functions::Pgr_boyerMyrvold fn_boyerMyrvold; results = fn_boyerMyrvold.boyerMyrvold(undigraph); diff --git a/src/planar/isPlanar_driver.cpp b/src/planar/isPlanar_driver.cpp index 0e3b0cfa10..0074935a03 100644 --- a/src/planar/isPlanar_driver.cpp +++ b/src/planar/isPlanar_driver.cpp @@ -64,7 +64,6 @@ pgr_do_isPlanar( pgassert(!(*err_msg)); bool result = false; - graphType gType = UNDIRECTED; hint = edges_sql; auto edges = get_edges(std::string(edges_sql), true, true); @@ -74,8 +73,7 @@ pgr_do_isPlanar( } hint = nullptr; - log << "Working with Undirected Graph\n"; - pgrouting::UndirectedGraph undigraph(gType); + pgrouting::UndirectedGraph undigraph(false); undigraph.insert_edges(edges); pgrouting::functions::Pgr_boyerMyrvold fn_isPlanar; result = fn_isPlanar.isPlanar(undigraph); diff --git a/src/spanningTree/kruskal_driver.cpp b/src/spanningTree/kruskal_driver.cpp index c4d2d856b5..887027d815 100644 --- a/src/spanningTree/kruskal_driver.cpp +++ b/src/spanningTree/kruskal_driver.cpp @@ -84,7 +84,7 @@ pgr_do_kruskal( std::vector results; - pgrouting::UndirectedGraph undigraph(UNDIRECTED); + pgrouting::UndirectedGraph undigraph(false); undigraph.insert_edges(edges); pgrouting::functions::Pgr_kruskal kruskal; diff --git a/src/spanningTree/prim_driver.cpp b/src/spanningTree/prim_driver.cpp index e641f127f0..a25cbc07e9 100644 --- a/src/spanningTree/prim_driver.cpp +++ b/src/spanningTree/prim_driver.cpp @@ -86,7 +86,7 @@ pgr_do_prim( std::vector results; - pgrouting::UndirectedGraph undigraph(UNDIRECTED); + pgrouting::UndirectedGraph undigraph(false); undigraph.insert_min_edges_no_parallel(edges); pgrouting::functions::Pgr_prim prim; diff --git a/src/spanningTree/randomSpanningTree_driver.cpp b/src/spanningTree/randomSpanningTree_driver.cpp index 9acd1ac07b..e3161bbb4e 100644 --- a/src/spanningTree/randomSpanningTree_driver.cpp +++ b/src/spanningTree/randomSpanningTree_driver.cpp @@ -87,20 +87,20 @@ pgr_do_randomSpanningTree( } hint = nullptr; - graphType gType = directed? DIRECTED: UNDIRECTED; + std::vector results; if (directed) { log << "Working with directed Graph\n"; - pgrouting::DirectedGraph digraph(gType); + pgrouting::DirectedGraph digraph(directed); digraph.insert_edges(data_edges, total_edges); results = pgr_randomSpanningTree( digraph, root_vertex); } else { log << "Working with Undirected Graph\n"; - pgrouting::UndirectedGraph undigraph(gType); + pgrouting::UndirectedGraph undigraph(directed); undigraph.insert_edges(data_edges, total_edges); results = pgr_randomSpanningTree( undigraph, diff --git a/src/topologicalSort/topologicalSort_driver.cpp b/src/topologicalSort/topologicalSort_driver.cpp index a76ffbfd26..cf1aa75acc 100644 --- a/src/topologicalSort/topologicalSort_driver.cpp +++ b/src/topologicalSort/topologicalSort_driver.cpp @@ -90,11 +90,8 @@ pgr_do_topologicalSort( } hint = nullptr; - graphType gType = DIRECTED; - std::vector results; - - pgrouting::DirectedGraph digraph(gType); + pgrouting::DirectedGraph digraph(true); digraph.insert_edges(edges); results = pgr_topologicalSort( digraph); diff --git a/src/transitiveClosure/transitiveClosure_driver.cpp b/src/transitiveClosure/transitiveClosure_driver.cpp index 7232bc74b8..fa032438d3 100644 --- a/src/transitiveClosure/transitiveClosure_driver.cpp +++ b/src/transitiveClosure/transitiveClosure_driver.cpp @@ -126,8 +126,7 @@ pgr_do_transitiveClosure( } hint = nullptr; - graphType gType = DIRECTED; - pgrouting::DirectedGraph digraph(gType); + pgrouting::DirectedGraph digraph(true); digraph.insert_edges(edges); get_postgres_result( diff --git a/src/traversal/depthFirstSearch_driver.cpp b/src/traversal/depthFirstSearch_driver.cpp index 0534e4b6d8..9cd3174150 100644 --- a/src/traversal/depthFirstSearch_driver.cpp +++ b/src/traversal/depthFirstSearch_driver.cpp @@ -112,7 +112,6 @@ pgr_do_depthFirstSearch( auto roots = get_intArray(starts, false); std::vector results; - graphType gType = directed ? DIRECTED : UNDIRECTED; hint = edges_sql; auto edges = pgrouting::pgget::get_edges(std::string(edges_sql), true, false); @@ -124,7 +123,7 @@ pgr_do_depthFirstSearch( *log_msg = pgr_msg(edges_sql); } else { if (directed) { - pgrouting::DirectedGraph digraph(gType); + pgrouting::DirectedGraph digraph(directed); digraph.insert_edges(edges); results = pgr_depthFirstSearch( @@ -133,7 +132,7 @@ pgr_do_depthFirstSearch( directed, max_depth); } else { - pgrouting::UndirectedGraph undigraph(gType); + pgrouting::UndirectedGraph undigraph(directed); undigraph.insert_edges(edges); results = pgr_depthFirstSearch( diff --git a/src/trsp/trspVia_driver.cpp b/src/trsp/trspVia_driver.cpp index d2bb0d5db6..9c42334fb5 100644 --- a/src/trsp/trspVia_driver.cpp +++ b/src/trsp/trspVia_driver.cpp @@ -176,11 +176,11 @@ pgr_do_trspVia( hint = nullptr; - graphType gType = directed? DIRECTED: UNDIRECTED; + std::deque paths; if (directed) { - pgrouting::DirectedGraph digraph(gType); + pgrouting::DirectedGraph digraph(directed); digraph.insert_edges(edges); pgrouting::pgr_dijkstraVia( digraph, @@ -190,7 +190,7 @@ pgr_do_trspVia( U_turn_on_edge, log); } else { - pgrouting::UndirectedGraph undigraph(gType); + pgrouting::UndirectedGraph undigraph(directed); undigraph.insert_edges(edges); pgrouting::pgr_dijkstraVia( undigraph, diff --git a/src/trsp/trspVia_withPoints_driver.cpp b/src/trsp/trspVia_withPoints_driver.cpp index c2ca4cedfc..f2553ad3c0 100644 --- a/src/trsp/trspVia_withPoints_driver.cpp +++ b/src/trsp/trspVia_withPoints_driver.cpp @@ -186,9 +186,6 @@ pgr_do_trspVia_withPoints( auto restrictions = restrictions_sql? pgrouting::pgget::get_restrictions(std::string(restrictions_sql)) : std::vector(); - - graphType gType = directed? DIRECTED: UNDIRECTED; - /* Dealing with points */ pgrouting::Pg_points_graph pg_graph( points, edges_of_points, @@ -210,7 +207,7 @@ pgr_do_trspVia_withPoints( std::deque paths; if (directed) { - pgrouting::DirectedGraph digraph(vertices, gType); + pgrouting::DirectedGraph digraph(vertices, directed); digraph.insert_edges(edges); digraph.insert_edges(pg_graph.new_edges()); pgrouting::pgr_dijkstraVia( @@ -221,7 +218,7 @@ pgr_do_trspVia_withPoints( U_turn_on_edge, log); } else { - pgrouting::UndirectedGraph undigraph(vertices, gType); + pgrouting::UndirectedGraph undigraph(vertices, directed); undigraph.insert_edges(edges); undigraph.insert_edges(pg_graph.new_edges()); pgrouting::pgr_dijkstraVia( diff --git a/src/trsp/trsp_driver.cpp b/src/trsp/trsp_driver.cpp index e6d3b4278b..bcb7f0fcdb 100644 --- a/src/trsp/trsp_driver.cpp +++ b/src/trsp/trsp_driver.cpp @@ -147,18 +147,18 @@ pgr_do_trsp( return; } - graphType gType = directed? DIRECTED: UNDIRECTED; + std::deque paths; if (directed) { - pgrouting::DirectedGraph digraph(gType); + pgrouting::DirectedGraph digraph(directed); digraph.insert_edges(edges); paths = pgr_dijkstra( digraph, combinations); } else { - pgrouting::UndirectedGraph undigraph(gType); + pgrouting::UndirectedGraph undigraph(directed); undigraph.insert_edges(edges); paths = pgr_dijkstra( diff --git a/src/trsp/trsp_withPoints_driver.cpp b/src/trsp/trsp_withPoints_driver.cpp index fb90757890..4dabdfadd9 100644 --- a/src/trsp/trsp_withPoints_driver.cpp +++ b/src/trsp/trsp_withPoints_driver.cpp @@ -142,7 +142,7 @@ pgr_do_trsp_withPoints( pgrouting::pgget::get_restrictions(std::string(restrictions_sql)) : std::vector(); - graphType gType = directed? DIRECTED: UNDIRECTED; + /* Dealing with points */ pgrouting::Pg_points_graph pg_graph( @@ -165,7 +165,7 @@ pgr_do_trsp_withPoints( std::deque paths; if (directed) { - pgrouting::DirectedGraph digraph(vertices, gType); + pgrouting::DirectedGraph digraph(vertices, directed); digraph.insert_edges(edges); digraph.insert_edges(pg_graph.new_edges()); @@ -174,7 +174,7 @@ pgr_do_trsp_withPoints( combinations, false, (std::numeric_limits::max)()); } else { - pgrouting::UndirectedGraph undigraph(vertices, gType); + pgrouting::UndirectedGraph undigraph(vertices, directed); undigraph.insert_edges(edges); undigraph.insert_edges(pg_graph.new_edges()); diff --git a/src/withPoints/withPointsVia_driver.cpp b/src/withPoints/withPointsVia_driver.cpp index f2e27d492e..3107441008 100644 --- a/src/withPoints/withPointsVia_driver.cpp +++ b/src/withPoints/withPointsVia_driver.cpp @@ -129,7 +129,7 @@ pgr_do_withPointsVia( auto via_vertices = get_intArray(starts, false); - graphType gType = directed? DIRECTED: UNDIRECTED; + hint = points_sql; auto points = pgrouting::pgget::get_points(std::string(points_sql)); @@ -169,7 +169,7 @@ pgr_do_withPointsVia( std::deque paths; if (directed) { - pgrouting::DirectedGraph digraph(vertices, gType); + pgrouting::DirectedGraph digraph(vertices, directed); digraph.insert_edges(edges); digraph.insert_edges(pg_graph.new_edges()); pgrouting::pgr_dijkstraVia( @@ -180,7 +180,7 @@ pgr_do_withPointsVia( U_turn_on_edge, log); } else { - pgrouting::UndirectedGraph undigraph(vertices, gType); + pgrouting::UndirectedGraph undigraph(vertices, directed); undigraph.insert_edges(edges); undigraph.insert_edges(pg_graph.new_edges()); pgrouting::pgr_dijkstraVia( diff --git a/src/withPoints/withPoints_driver.cpp b/src/withPoints/withPoints_driver.cpp index 8c64f3877b..20e79c5878 100644 --- a/src/withPoints/withPoints_driver.cpp +++ b/src/withPoints/withPoints_driver.cpp @@ -114,7 +114,7 @@ pgr_do_withPoints( pgassert(!(*return_tuples)); pgassert(*return_count == 0); - graphType gType = directed? DIRECTED: UNDIRECTED; + hint = combinations_sql; auto combinations = get_combinations(combinations_sql, starts, ends, normal); @@ -164,7 +164,7 @@ pgr_do_withPoints( std::deque paths; if (directed) { - pgrouting::DirectedGraph digraph(vertices, gType); + pgrouting::DirectedGraph digraph(vertices, directed); digraph.insert_edges(edges); digraph.insert_edges(pg_graph.new_edges()); @@ -173,7 +173,7 @@ pgr_do_withPoints( combinations, only_cost, normal); } else { - pgrouting::UndirectedGraph undigraph(vertices, gType); + pgrouting::UndirectedGraph undigraph(vertices, directed); undigraph.insert_edges(edges); undigraph.insert_edges(pg_graph.new_edges()); paths = pgr_dijkstra(