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();
82 size_t total_positive_edges,
84 size_t total_negative_edges,
86 size_t total_combinations,
87 int64_t *start_vidsArr,
88 size_t size_start_vidsArr,
90 size_t size_end_vidsArr,
99 std::ostringstream log;
100 std::ostringstream err;
101 std::ostringstream notice;
102 size_t total_edges = total_positive_edges + total_negative_edges;
110 pgassert(total_positive_edges || total_negative_edges);
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";
119 start_vertices(start_vidsArr, start_vidsArr + size_start_vidsArr);
120 std::vector< int64_t >
121 end_vertices(end_vidsArr, end_vidsArr + size_end_vidsArr);
122 std::vector< pgr_combination_t >
123 combinations_vector(combinations, combinations + total_combinations);
125 std::deque< Path >paths;
128 log <<
"Working with directed Graph\n";
130 digraph.
insert_edges(positive_edges, total_positive_edges);
140 log <<
"Working with Undirected Graph\n";
142 undigraph.
insert_edges(positive_edges, total_positive_edges);
145 total_negative_edges);
160 (*return_tuples) = NULL;
164 *log_msg =
pgr_msg(notice.str().c_str());
168 (*return_tuples) =
pgr_alloc(count, (*return_tuples));
169 log <<
"\nConverting a set of paths into the tuples";
172 *log_msg = log.str().empty()?
175 *notice_msg = notice.str().empty()?
179 (*return_tuples) =
pgr_free(*return_tuples);
181 err << except.
what();
182 *err_msg =
pgr_msg(err.str().c_str());
183 *log_msg =
pgr_msg(log.str().c_str());
184 }
catch (std::exception &except) {
185 (*return_tuples) =
pgr_free(*return_tuples);
187 err << except.what();
188 *err_msg =
pgr_msg(err.str().c_str());
189 *log_msg =
pgr_msg(log.str().c_str());
191 (*return_tuples) =
pgr_free(*return_tuples);
193 err <<
"Caught unknown exception!";
194 *err_msg =
pgr_msg(err.str().c_str());
195 *log_msg =
pgr_msg(log.str().c_str());