59 std::vector < int64_t > sources,
60 std::vector < int64_t > targets,
67 log <<
"entering static function\n";
68 std::sort(sources.begin(), sources.end());
70 std::unique(sources.begin(), sources.end()),
73 std::sort(targets.begin(), targets.end());
75 std::unique(targets.begin(), targets.end()),
80 std::deque<Path> paths;
81 for (
const auto source : sources) {
82 for (
const auto target : targets) {
86 graph.get_V(source), graph.get_V(target),
87 heuristic, factor, epsilon, only_cost));
90 log << fn_bdAstar.
log();
100 int64_t *start_vidsArr,
101 size_t size_start_vidsArr,
102 int64_t *end_vidsArr,
103 size_t size_end_vidsArr,
113 size_t *return_count,
118 std::ostringstream log;
119 std::ostringstream err;
120 std::ostringstream notice;
130 log <<
"Inserting vertices into a c++ vector structure";
132 start_vertices(start_vidsArr, start_vidsArr + size_start_vidsArr);
133 std::vector< int64_t >
134 end_vertices(end_vidsArr, end_vidsArr + size_end_vidsArr);
138 std::deque<Path> paths;
139 log <<
"starting process\n";
141 log <<
"Working with directed Graph\n";
156 log <<
"Working with Undirected Graph\n";
177 (*return_tuples) = NULL;
181 *log_msg =
pgr_msg(notice.str().c_str());
185 (*return_tuples) =
pgr_alloc(count, (*return_tuples));
186 log <<
"\nConverting a set of paths into the tuples";
191 auto count = path.size();
194 (*return_tuples) = NULL;
197 "No paths found between start_vid and end_vid vertices";
199 (*return_tuples) =
pgr_alloc(count, (*return_tuples));
201 path.generate_postgres_data(return_tuples, sequence);
202 (*return_count) = sequence;
207 *log_msg = log.str().empty()?
210 *notice_msg = notice.str().empty()?
214 if (*return_tuples) free(*return_tuples);
216 err << except.
what();
217 *err_msg =
pgr_msg(err.str().c_str());
218 *log_msg =
pgr_msg(log.str().c_str());
219 }
catch (std::exception& except) {
220 if (*return_tuples) free(*return_tuples);
222 err << except.what();
223 *err_msg =
pgr_msg(err.str().c_str());
224 *log_msg =
pgr_msg(log.str().c_str());
226 if (*return_tuples) free(*return_tuples);
228 err <<
"Caught unknown exception!";
229 *err_msg =
pgr_msg(err.str().c_str());
230 *log_msg =
pgr_msg(log.str().c_str());
static edge_t edges[22573]
Extends std::exception and is the exception that we throw if an assert fails.
void insert_edges(const T *edges, int64_t count)
Inserts count edges of type T into the graph.
void do_pgr_bdAstar(Pgr_edge_xy_t *edges, size_t total_edges, int64_t *start_vidsArr, size_t size_start_vidsArr, int64_t *end_vidsArr, size_t size_end_vidsArr, bool directed, int heuristic, double factor, double epsilon, bool only_cost, General_path_element_t **return_tuples, size_t *return_count, char **log_msg, char **notice_msg, char **err_msg)
size_t collapse_paths(General_path_element_t **ret_path, const std::deque< Path > &paths)
static std::deque< Path > pgr_bdAstar(G &graph, std::vector< int64_t > sources, std::vector< int64_t > targets, int heuristic, double factor, double epsilon, std::ostream &log, bool only_cost)
#define pgassert(expr)
Uses the standard assert syntax.
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
Path pgr_bdAstar(V start_vertex, V end_vertex, int heuristic, double factor, double epsilon, bool only_cost)
virtual const char * what() const