41 #include "./pgr_dijkstra.hpp"
42 #include "./many_to_one_dijkstra_driver.h"
46 #include "../../common/src/memory_func.hpp"
48 #include "./../../common/src/pgr_types.h"
57 do_pgr_many_to_one_dijkstra(
60 int64_t *start_vidsArr,
61 size_t size_start_vidsArr,
68 std::ostringstream log;
70 graphType gType = directed? DIRECTED: UNDIRECTED;
71 const auto initial_size = total_tuples;
73 std::deque< Path >paths;
74 log <<
"Inserting vertices into a c++ vector structure\n";
75 std::set< int64_t > s_start_vertices(start_vidsArr, start_vidsArr + size_start_vidsArr);
76 std::vector< int64_t > start_vertices(s_start_vertices.begin(), s_start_vertices.end());
79 log <<
"Working with directed Graph\n";
81 digraph.graph_insert_data(data_edges, total_tuples);
82 pgr_dijkstra(digraph, paths, start_vertices, end_vid, only_cost);
84 log <<
"Working with Undirected Graph\n";
86 undigraph.graph_insert_data(data_edges, total_tuples);
87 pgr_dijkstra(undigraph, paths, start_vertices, end_vid, only_cost);
92 count = count_tuples(paths);
96 (*return_tuples) = NULL;
99 "No paths found between Starting and any of the Ending vertices\n";
100 *err_msg = strdup(log.str().c_str());
104 (*return_tuples) = get_memory(count, (*return_tuples));
105 log <<
"Converting a set of paths into the tuples\n";
106 (*return_count) = (collapse_paths(return_tuples, paths));
110 *err_msg = strdup(
"OK");
112 *err_msg = strdup(log.str().c_str());
117 log <<
"Caught unknown expection!\n";
118 *err_msg = strdup(log.str().c_str());