59 std::vector < pgr_combination_t > &combinations,
60 std::vector < int64_t > sources,
61 std::vector < int64_t > targets,
68 log <<
"entering static function\n";
71 std::deque<Path> paths;
73 if (combinations.empty()) {
74 std::sort(sources.begin(), sources.end());
76 std::unique(sources.begin(), sources.end()),
79 std::sort(targets.begin(), targets.end());
81 std::unique(targets.begin(), targets.end()),
84 for (
const auto source : sources) {
85 for (
const auto target : targets) {
88 if (!graph.has_vertex(source)
89 || !graph.has_vertex(target)) {
90 paths.push_back(
Path(source, target));
95 graph.get_V(source), graph.get_V(target),
96 heuristic, factor, epsilon, only_cost));
101 std::sort(combinations.begin(), combinations.end(),
103 return lhs.target < rhs.target;
105 std::stable_sort(combinations.begin(), combinations.end(),
107 return lhs.source < rhs.source;
115 if (comb.source == previousCombination.source &&
116 comb.target == previousCombination.target) {
120 if (!graph.has_vertex(comb.source)
121 || !graph.has_vertex(comb.target)) {
122 paths.push_back(
Path(comb.source, comb.target));
127 graph.get_V(comb.source), graph.get_V(comb.target),
128 heuristic, factor, epsilon, only_cost));
130 previousCombination = comb;
134 log << fn_bdAstar.
log();
145 size_t total_combinations,
146 int64_t *start_vidsArr,
147 size_t size_start_vidsArr,
148 int64_t *end_vidsArr,
149 size_t size_end_vidsArr,
159 size_t *return_count,
164 std::ostringstream log;
165 std::ostringstream err;
166 std::ostringstream notice;
176 log <<
"Inserting vertices into a c++ vector structure";
178 start_vertices(start_vidsArr, start_vidsArr + size_start_vidsArr);
179 std::vector< int64_t >
180 end_vertices(end_vidsArr, end_vidsArr + size_end_vidsArr);
181 std::vector< pgr_combination_t >
182 combinations_vector(combinations, combinations + total_combinations);
186 std::deque<Path> paths;
187 log <<
"starting process\n";
189 log <<
"Working with directed Graph\n";
205 log <<
"Working with Undirected Graph\n";
227 (*return_tuples) = NULL;
231 *log_msg =
pgr_msg(notice.str().c_str());
235 (*return_tuples) =
pgr_alloc(count, (*return_tuples));
236 log <<
"\nConverting a set of paths into the tuples";
241 auto count = path.size();
244 (*return_tuples) = NULL;
247 "No paths found between start_vid and end_vid vertices";
249 (*return_tuples) =
pgr_alloc(count, (*return_tuples));
251 path.generate_postgres_data(return_tuples, sequence);
252 (*return_count) = sequence;
257 *log_msg = log.str().empty()?
260 *notice_msg = notice.str().empty()?
264 if (*return_tuples) free(*return_tuples);
266 err << except.
what();
267 *err_msg =
pgr_msg(err.str().c_str());
268 *log_msg =
pgr_msg(log.str().c_str());
269 }
catch (std::exception& except) {
270 if (*return_tuples) free(*return_tuples);
272 err << except.what();
273 *err_msg =
pgr_msg(err.str().c_str());
274 *log_msg =
pgr_msg(log.str().c_str());
276 if (*return_tuples) free(*return_tuples);
278 err <<
"Caught unknown exception!";
279 *err_msg =
pgr_msg(err.str().c_str());
280 *log_msg =
pgr_msg(log.str().c_str());