56 std::vector <pgr_combination_t> &combinations,
57 std::vector < int64_t > sources,
58 std::vector < int64_t > targets,
60 bool only_cost =
false) {
61 std::sort(sources.begin(), sources.end());
63 std::unique(sources.begin(), sources.end()),
66 std::sort(targets.begin(), targets.end());
68 std::unique(targets.begin(), targets.end()),
72 auto paths = combinations.empty() ?
73 fn_bellman_ford.
bellman_ford(graph, sources, targets, only_cost)
74 : fn_bellman_ford.
bellman_ford(graph, combinations, only_cost);
75 log += fn_bellman_ford.
get_log();
76 for (
auto &p : paths) {
77 p.recalculate_agg_cost();
87 size_t total_combinations,
88 int64_t *start_vidsArr,
89 size_t size_start_vidsArr,
91 size_t size_end_vidsArr,
100 std::ostringstream log;
101 std::ostringstream err;
102 std::ostringstream notice;
111 pgassert((start_vidsArr && end_vidsArr) || combinations);
112 pgassert((size_start_vidsArr && size_end_vidsArr) || total_combinations);
116 log <<
"Inserting vertices into a c++ vector structure";
118 start_vertices(start_vidsArr, start_vidsArr + size_start_vidsArr);
119 std::vector< int64_t >
120 end_vertices(end_vidsArr, end_vidsArr + size_end_vidsArr);
121 std::vector< pgr_combination_t >
122 combinations_vector(combinations, combinations + total_combinations);
124 std::deque< Path >paths;
127 log <<
"Working with directed Graph\n";
137 log <<
"Working with Undirected Graph\n";
153 (*return_tuples) = NULL;
157 *log_msg =
pgr_msg(notice.str().c_str());
161 (*return_tuples) =
pgr_alloc(count, (*return_tuples));
162 log <<
"\nConverting a set of paths into the tuples";
165 *log_msg = log.str().empty()?
168 *notice_msg = notice.str().empty()?
172 (*return_tuples) =
pgr_free(*return_tuples);
174 err << except.
what();
175 *err_msg =
pgr_msg(err.str().c_str());
176 *log_msg =
pgr_msg(log.str().c_str());
177 }
catch (std::exception &except) {
178 (*return_tuples) =
pgr_free(*return_tuples);
180 err << except.what();
181 *err_msg =
pgr_msg(err.str().c_str());
182 *log_msg =
pgr_msg(log.str().c_str());
184 (*return_tuples) =
pgr_free(*return_tuples);
186 err <<
"Caught unknown exception!";
187 *err_msg =
pgr_msg(err.str().c_str());
188 *log_msg =
pgr_msg(log.str().c_str());