49 std::vector <pgr_combination_t> &combinations,
50 std::vector < int64_t > sources,
51 std::vector < int64_t > targets) {
52 std::sort(sources.begin(), sources.end());
54 std::unique(sources.begin(), sources.end()),
57 std::sort(targets.begin(), targets.end());
59 std::unique(targets.begin(), targets.end()),
63 auto paths = combinations.empty() ?
71 const char COST_ERR_MSG[] =
"Graph Condition Failed: Graph should have atmost two distinct non-negative edge costs! "
72 "If there are exactly two distinct edge costs, one of them must equal zero!";
76 typedef typename G::E E;
77 typedef typename G::E_i E_i;
79 auto edges = boost::edges(graph.graph);
83 std::set<double> cost_set;
84 for (boost::tie(out_i, out_end) = edges;
85 out_i != out_end; ++out_i) {
87 cost_set.insert(graph[e].cost);
94 if (cost_set.size() == 2) {
95 if (*cost_set.begin() != 0.0) {
110 size_t total_combinations,
111 int64_t *start_vidsArr,
112 size_t size_start_vidsArr,
113 int64_t *end_vidsArr,
114 size_t size_end_vidsArr,
118 size_t *return_count,
122 std::ostringstream log;
123 std::ostringstream err;
124 std::ostringstream notice;
134 pgassert((start_vidsArr && end_vidsArr) || combinations);
135 pgassert((size_start_vidsArr && size_end_vidsArr) || total_combinations);
141 start_vertices(start_vidsArr, start_vidsArr + size_start_vidsArr);
142 std::vector< int64_t >
143 end_vertices(end_vidsArr, end_vidsArr + size_end_vidsArr);
144 std::vector< pgr_combination_t >
145 combinations_vector(combinations, combinations + total_combinations);
147 std::deque< Path >paths;
155 *err_msg =
pgr_msg(err.str().c_str());
171 *err_msg =
pgr_msg(err.str().c_str());
186 (*return_tuples) = NULL;
190 *log_msg =
pgr_msg(notice.str().c_str());
194 (*return_tuples) =
pgr_alloc(count, (*return_tuples));
195 log <<
"\nConverting a set of paths into the tuples";
198 *log_msg = log.str().empty()?
201 *notice_msg = notice.str().empty()?
205 (*return_tuples) =
pgr_free(*return_tuples);
207 err << except.
what();
208 *err_msg =
pgr_msg(err.str().c_str());
209 *log_msg =
pgr_msg(log.str().c_str());
210 }
catch (std::exception &except) {
211 (*return_tuples) =
pgr_free(*return_tuples);
213 err << except.what();
214 *err_msg =
pgr_msg(err.str().c_str());
215 *log_msg =
pgr_msg(log.str().c_str());
217 (*return_tuples) =
pgr_free(*return_tuples);
219 err <<
"Caught unknown exception!";
220 *err_msg =
pgr_msg(err.str().c_str());
221 *log_msg =
pgr_msg(log.str().c_str());