48 std::vector <pgr_combination_t> &combinations,
49 std::vector<int64_t> sources,
50 std::vector<int64_t> targets,
56 std::sort(sources.begin(), sources.end());
58 std::unique(sources.begin(), sources.end()),
61 std::sort(targets.begin(), targets.end());
63 std::unique(targets.begin(), targets.end()),
67 auto paths = combinations.empty() ?
68 fn_astar.
astar(graph, sources, targets, heuristic, factor, epsilon, only_cost)
69 : fn_astar.
astar(graph, combinations, heuristic, factor, epsilon, only_cost);
72 for (
auto &path : paths) {
91 int64_t *start_vidsArr,
size_t size_start_vidsArr,
92 int64_t *end_vidsArr,
size_t size_end_vidsArr,
100 size_t *return_count,
104 std::ostringstream log;
105 std::ostringstream notice;
106 std::ostringstream err;
115 log <<
"Inserting target vertices into a c++ vector structure\n";
116 std::vector<pgr_combination_t>
117 combinations_vector(combinations, combinations + total_combinations);
118 std::vector< int64_t > end_vids(
120 end_vidsArr + size_end_vidsArr);
121 std::vector< int64_t > start_vids(
123 start_vidsArr + size_start_vidsArr);
127 std::deque< Path >paths;
129 log <<
"Working with directed Graph\n";
134 paths =
pgr_astar(digraph, combinations_vector, start_vids, end_vids,
135 heuristic, factor, epsilon, only_cost, normal);
137 log <<
"Working with Undirected Graph\n";
142 paths =
pgr_astar(undigraph, combinations_vector, start_vids, end_vids,
143 heuristic, factor, epsilon, only_cost, normal);
151 (*return_tuples) = NULL;
155 *log_msg =
pgr_msg(notice.str().c_str());
159 (*return_tuples) =
pgr_alloc(count, (*return_tuples));
160 log <<
"Converting a set of paths into the tuples\n";
163 *log_msg = log.str().empty()?
166 *notice_msg = notice.str().empty()?
170 (*return_tuples) =
pgr_free(*return_tuples);
172 err << except.
what();
173 *err_msg =
pgr_msg(err.str().c_str());
174 *log_msg =
pgr_msg(log.str().c_str());
175 }
catch (std::exception &except) {
176 (*return_tuples) =
pgr_free(*return_tuples);
178 err << except.what();
179 *err_msg =
pgr_msg(err.str().c_str());
180 *log_msg =
pgr_msg(log.str().c_str());
182 (*return_tuples) =
pgr_free(*return_tuples);
184 err <<
"Caught unknown exception!";
185 *err_msg =
pgr_msg(err.str().c_str());
186 *log_msg =
pgr_msg(log.str().c_str());