79 std::ostringstream log;
80 std::ostringstream notice;
81 std::ostringstream err;
83 std::set<int64_t> set_source_vertices(
84 sources, sources + size_source_verticesArr);
85 std::set<int64_t> set_sink_vertices(
86 sinks, sinks + size_sink_verticesArr);
87 std::vector<pgr_edge_t> edges(
88 data_edges, data_edges + total_edges);
91 std::vector<General_path_element_t> paths;
92 for (
const auto &s : set_source_vertices) {
93 for (
const auto &t : set_sink_vertices) {
99 paths.insert(paths.end(), path.begin(), path.end());
104 *return_tuples =
nullptr;
112 for (
auto &r : paths) {
119 auto found = paths.size();
120 for (
const auto &e : edges) {
121 for (
auto &r : paths) {
122 if (r.edge == e.id) {
123 r.cost = (r.node == e.source) ?
124 e.cost : e.reverse_cost;
128 if (found == 0)
break;
134 auto prev = paths[0];
135 for (
auto &r : paths) {
139 r.agg_cost = prev.agg_cost + prev.cost;
148 for (
auto &r : paths) {
149 r.start_id = path_id;
150 if (r.edge == -1) ++path_id;
154 (*return_tuples) =
pgr_alloc(paths.size(), (*return_tuples));
155 for (
size_t i = 0; i < paths.size(); ++i) {
156 (*return_tuples)[i] = paths[i];
158 *return_count = paths.size();
161 *log_msg = log.str().empty()?
164 *notice_msg = notice.str().empty()?
168 (*return_tuples) =
pgr_free(*return_tuples);
170 err << except.
what();
171 *err_msg =
pgr_msg(err.str().c_str());
172 *log_msg =
pgr_msg(log.str().c_str());
173 }
catch (std::exception &except) {
174 (*return_tuples) =
pgr_free(*return_tuples);
176 err << except.what();
177 *err_msg =
pgr_msg(err.str().c_str());
178 *log_msg =
pgr_msg(log.str().c_str());
180 (*return_tuples) =
pgr_free(*return_tuples);
182 err <<
"Caught unknown exception!";
183 *err_msg =
pgr_msg(err.str().c_str());
184 *log_msg =
pgr_msg(log.str().c_str());
Extends std::exception and is the exception that we throw if an assert fails.
static std::vector< General_path_element_t > single_execution(std::vector< pgr_edge_t > edges, int64_t source, int64_t target, bool directed)
char * pgr_msg(const std::string &msg)
T * pgr_alloc(std::size_t size, T *ptr)
allocates memory
virtual const char * what() const