53 std::vector < pgr_combination_t > &combinations,
54 std::vector < int64_t > sources,
55 std::vector < int64_t > targets,
59 log <<
"entering static function\n";
62 std::deque<Path> paths;
64 if (combinations.empty()) {
65 std::sort(sources.begin(), sources.end());
67 std::unique(sources.begin(), sources.end()),
70 std::sort(targets.begin(), targets.end());
72 std::unique(targets.begin(), targets.end()),
75 for (
const auto source : sources) {
76 for (
const auto target : targets) {
77 fn_bdDijkstra.
clear();
79 if (!graph.has_vertex(source)
80 || !graph.has_vertex(target)) {
81 paths.push_back(
Path(source, target));
86 graph.get_V(source), graph.get_V(target), only_cost));
91 std::sort(combinations.begin(), combinations.end(),
93 return lhs.target < rhs.target;
95 std::stable_sort(combinations.begin(), combinations.end(),
97 return lhs.source < rhs.source;
103 fn_bdDijkstra.
clear();
104 if (comb.source == previousCombination.source &&
105 comb.target == previousCombination.target) {
109 if (!graph.has_vertex(comb.source)
110 || !graph.has_vertex(comb.target)) {
111 paths.push_back(
Path(comb.source, comb.target));
116 graph.get_V(comb.source), graph.get_V(comb.target), only_cost));
118 previousCombination = comb;
122 log << fn_bdDijkstra.
log();
133 size_t total_combinations,
134 int64_t *start_vidsArr,
135 size_t size_start_vidsArr,
136 int64_t *end_vidsArr,
137 size_t size_end_vidsArr,
143 size_t *return_count,
147 std::ostringstream log;
148 std::ostringstream err;
149 std::ostringstream notice;
158 log <<
"Inserting vertices into a c++ vector structure";
160 start_vertices(start_vidsArr, start_vidsArr + size_start_vidsArr);
161 std::vector< int64_t >
162 end_vertices(end_vidsArr, end_vidsArr + size_end_vidsArr);
163 std::vector< pgr_combination_t >
164 combinations_vector(combinations, combinations + total_combinations);
168 std::deque<Path> paths;
170 log <<
"starting process\n";
172 log <<
"Working with directed Graph\n";
182 log <<
"Working with Undirected Graph\n";
198 (*return_tuples) = NULL;
202 *log_msg =
pgr_msg(notice.str().c_str());
206 (*return_tuples) =
pgr_alloc(count, (*return_tuples));
207 log <<
"\nConverting a set of paths into the tuples";
211 *log_msg = log.str().empty()?
214 *notice_msg = notice.str().empty()?
218 (*return_tuples) =
pgr_free(*return_tuples);
220 err << except.
what();
221 *err_msg =
pgr_msg(err.str().c_str());
222 *log_msg =
pgr_msg(log.str().c_str());
223 }
catch (std::exception &except) {
224 (*return_tuples) =
pgr_free(*return_tuples);
226 err << except.what();
227 *err_msg =
pgr_msg(err.str().c_str());
228 *log_msg =
pgr_msg(log.str().c_str());
230 (*return_tuples) =
pgr_free(*return_tuples);
232 err <<
"Caught unknown exception!";
233 *err_msg =
pgr_msg(err.str().c_str());
234 *log_msg =
pgr_msg(log.str().c_str());