|
PGROUTING
3.2
|
Go to the documentation of this file.
42 std::vector<pgr_randomSpanningTree_t>
45 int64_t root_vertex ) {
62 std::ostringstream log;
63 std::ostringstream err;
64 std::ostringstream notice;
75 std::vector<pgr_randomSpanningTree_t> results;
78 log <<
"Working with directed Graph\n";
85 log <<
"Working with Undirected Graph\n";
93 auto count = results.size();
96 (*return_tuples) = NULL;
103 (*return_tuples) =
pgr_alloc(count, (*return_tuples));
104 for (
size_t i = 0; i < count; i++) {
105 *((*return_tuples) + i) = results[i];
107 (*return_count) = count;
110 *log_msg = log.str().empty()?
113 *notice_msg = notice.str().empty()?
117 (*return_tuples) =
pgr_free(*return_tuples);
119 err << except.
what();
120 *err_msg =
pgr_msg(err.str().c_str());
121 *log_msg =
pgr_msg(log.str().c_str());
122 }
catch (std::exception &except) {
123 (*return_tuples) =
pgr_free(*return_tuples);
125 err << except.what();
126 *err_msg =
pgr_msg(err.str().c_str());
127 *log_msg =
pgr_msg(log.str().c_str());
129 (*return_tuples) =
pgr_free(*return_tuples);
131 err <<
"Caught unknown exception!";
132 *err_msg =
pgr_msg(err.str().c_str());
133 *log_msg =
pgr_msg(log.str().c_str());
void do_pgr_randomSpanningTree(pgr_edge_t *data_edges, size_t total_edges, int64_t root_vertex, bool directed, pgr_randomSpanningTree_t **return_tuples, size_t *return_count, char **log_msg, char **notice_msg, char **err_msg)
T * pgr_alloc(std::size_t size, T *ptr)
allocates memory
std::vector< pgr_randomSpanningTree_t > randomSpanningTree(G &graph, int64_t root_vertex)
char * pgr_msg(const std::string &msg)
virtual const char * what() const
static std::vector< pgr_randomSpanningTree_t > pgr_randomSpanningTree(G &graph, int64_t root_vertex)
#define pgassert(expr)
Uses the standard assert syntax.
void insert_edges(const T *edges, size_t count)
Inserts count edges of type T into the graph.
An assert functionality that uses C++ throw().
graph::Pgr_base_graph< BG, XY_vertex, Basic_edge > G
Extends std::exception and is the exception that we throw if an assert fails.