49 std::vector < int64_t > sources,
50 std::vector < int64_t > targets,
53 std::sort(sources.begin(), sources.end());
55 std::unique(sources.begin(), sources.end()),
58 std::sort(targets.begin(), targets.end());
60 std::unique(targets.begin(), targets.end()),
64 auto paths = fn_dijkstra.
dijkstra(graph, sources, targets, only_cost);
67 for (
auto &path : paths) {
72 for (
auto &p : paths) {
73 p.recalculate_agg_cost();
91 pgr_edge_t *edges_of_points,
size_t total_edges_of_points,
92 int64_t *start_pidsArr,
size_t size_start_pidsArr,
93 int64_t *end_pidsArr,
size_t size_end_pidsArr,
106 std::ostringstream log;
107 std::ostringstream notice;
108 std::ostringstream err;
120 std::vector<Point_on_edge_t>(
122 points_p + total_points),
123 std::vector< pgr_edge_t >(
125 edges_of_points + total_edges_of_points),
133 *log_msg =
pgr_msg(log.str().c_str());
134 *err_msg =
pgr_msg(err.str().c_str());
140 start_vertices(start_pidsArr, start_pidsArr + size_start_pidsArr);
141 std::vector< int64_t >
142 end_vertices(end_pidsArr, end_pidsArr + size_end_pidsArr);
149 std::deque< Path > paths;
152 log <<
"Working with directed Graph\n";
159 start_vertices, end_vertices,
162 log <<
"Working with Undirected Graph\n";
168 start_vertices, end_vertices,
173 for (
auto &path : paths) {
181 std::sort(paths.begin(), paths.end(),
187 return a.
end_id() < b.end_id();
195 (*return_tuples) = NULL;
200 (*return_tuples) =
pgr_alloc(count, (*return_tuples));
201 log <<
"Converting a set of paths into the tuples\n";
204 log <<
"************************************************";
206 log <<
"************************************************";
208 *log_msg = log.str().empty()?
211 *notice_msg = notice.str().empty()?
215 (*return_tuples) =
pgr_free(*return_tuples);
217 err << except.
what();
218 *err_msg =
pgr_msg(err.str().c_str());
219 *log_msg =
pgr_msg(log.str().c_str());
220 }
catch (std::exception &except) {
221 (*return_tuples) =
pgr_free(*return_tuples);
223 err << except.what();
224 *err_msg =
pgr_msg(err.str().c_str());
225 *log_msg =
pgr_msg(log.str().c_str());
227 (*return_tuples) =
pgr_free(*return_tuples);
229 err <<
"Caught unknown exception!";
230 *err_msg =
pgr_msg(err.str().c_str());
231 *log_msg =
pgr_msg(log.str().c_str());
Extends std::exception and is the exception that we throw if an assert fails.
std::string get_error() const
get_error
size_t collapse_paths(General_path_element_t **ret_path, const std::deque< Path > &paths)
std::vector< pgr_edge_t > new_edges() const
std::deque< Path > pgr_dijkstra(G &graph, std::vector< int64_t > sources, std::vector< int64_t > targets, bool only_cost, bool normal)
Path eliminate_details(Path path) const
graph::Pgr_base_graph< BG, XY_vertex, Basic_edge > G
#define pgassert(expr)
Uses the standard assert syntax.
void do_pgr_withPoints(pgr_edge_t *edges, size_t total_edges, Point_on_edge_t *points_p, size_t total_points, pgr_edge_t *edges_of_points, size_t total_edges_of_points, int64_t *start_pidsArr, size_t size_start_pidsArr, int64_t *end_pidsArr, size_t size_end_pidsArr, char driving_side, bool details, bool directed, bool only_cost, bool normal, General_path_element_t **return_tuples, size_t *return_count, char **log_msg, char **notice_msg, char **err_msg)
std::string get_log() const
get_log
Path dijkstra(G &graph, int64_t start_vertex, int64_t end_vertex, bool only_cost=false)
Dijkstra 1 to 1.
bool has_error() const
get_error
std::vector< Basic_vertex > extract_vertices(std::vector< Basic_vertex > vertices, const std::vector< pgr_edge_t > data_edges)
char * pgr_msg(const std::string &msg)
size_t count_tuples(const std::deque< Path > &paths)
T * pgr_alloc(std::size_t size, T *ptr)
allocates memory
virtual const char * what() const
void insert_edges(const T *edges, size_t count)
Inserts count edges of type T into the graph.