Skip to content

Commit

Permalink
[dijkstra] Removing unused code and unnecesary comments
Browse files Browse the repository at this point in the history
  • Loading branch information
cvvergara committed May 12, 2023
1 parent 4d5abbe commit 7ff6cbe
Showing 1 changed file with 0 additions and 70 deletions.
70 changes: 0 additions & 70 deletions src/dijkstra/dijkstra_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


#include "c_types/ii_t_rt.h"
/* this include gets the set of combinations
* aka map of source to set of targets*/
#include "cpp_common/combinations.h"
#include "cpp_common/pgr_alloc.hpp"
#include "cpp_common/pgr_assert.h"
Expand Down Expand Up @@ -100,44 +98,8 @@ post_process(std::deque<pgrouting::Path> &paths, bool only_cost, bool normal, si
}
}


#if 0
// This code is no longer used
template < class G >
std::deque<pgrouting::Path>
pgr_dijkstra(
G &graph,
std::vector < int64_t > sources,
std::vector < int64_t > targets,
bool only_cost,
bool normal,
size_t n_goals,
bool global) {
std::sort(sources.begin(), sources.end());
sources.erase(
std::unique(sources.begin(), sources.end()),
sources.end());

std::sort(targets.begin(), targets.end());
targets.erase(
std::unique(targets.begin(), targets.end()),
targets.end());

pgrouting::Pgr_dijkstra< G > fn_dijkstra;
auto paths = fn_dijkstra.dijkstra(
graph,
sources, targets,
only_cost, n_goals);

post_process(paths, only_cost, normal, n_goals, global);

return paths;
}
#endif

template <class G>
std::deque<pgrouting::Path>
/* Removing the prefix because its not called from C file */
dijkstra(
G &graph,
/* Now it receives a map */
Expand All @@ -156,7 +118,6 @@ void
pgr_do_dijkstra(
Edge_t *data_edges, size_t total_edges,

/* Standarizing with Arr, C arrays */
II_t_rt *combinationsArr, size_t total_combinations,
int64_t *start_vidsArr, size_t size_start_vidsArr,
int64_t *end_vidsArr, size_t size_end_vidsArr,
Expand Down Expand Up @@ -195,40 +156,9 @@ pgr_do_dijkstra(
size_t n = n_goals <= 0? (std::numeric_limits<size_t>::max)() : static_cast<size_t>(n_goals);
std::deque<Path>paths;

/* All dijkstra overloads on SQL file are converted to combinations overload style
* aka map from one source to a set of targets */
auto combinations = total_combinations?
pgrouting::utilities::get_combinations(combinationsArr, total_combinations)
: pgrouting::utilities::get_combinations(start_vidsArr, size_start_vidsArr, end_vidsArr, size_end_vidsArr);
#if 0
// this code is substitued by the above
std::vector<II_t_rt> combinations_vector(combinations, combinations + total_combinations);
std::vector<int64_t> start_vertices(start_vidsArr, start_vidsArr + size_start_vidsArr);
std::vector<int64_t> end_vertices(end_vidsArr, end_vidsArr + size_end_vidsArr);
#endif

#if 0
/* Remember I mentioned I did not like this many if-then-else */
if (directed) {
pgrouting::DirectedGraph digraph(gType);
digraph.insert_edges(data_edges, total_edges);

if (combinations_vector.empty()) {
paths = detail::pgr_dijkstra(digraph, start_vertices, end_vertices, only_cost, normal, n, global);
} else {
paths = detail::pgr_dijkstra(digraph, combinations_vector, only_cost, normal, n, global);
}
} else {
pgrouting::UndirectedGraph undigraph(gType);
undigraph.insert_edges(data_edges, total_edges);
if (combinations_vector.empty()) {
paths = detail::pgr_dijkstra(undigraph, start_vertices, end_vertices, only_cost, normal, n, global);
} else {
paths = detail::pgr_dijkstra(undigraph, combinations_vector, only_cost, normal, n, global);
}
}
/* I am changing to the following */
#endif

if (directed) {
pgrouting::DirectedGraph digraph(gType);
Expand Down

0 comments on commit 7ff6cbe

Please sign in to comment.