Go to the source code of this file.
◆ do_pgr_randomSpanningTree()
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 |
|
) |
| |
Definition at line 52 of file randomSpanningTree_driver.cpp.
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";
80 digraph.insert_edges(data_edges, total_edges);
85 log <<
"Working with Undirected Graph\n";
87 undigraph.insert_edges(data_edges, total_edges);
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());
References DIRECTED, pgrouting::graph::Pgr_base_graph< G, T_V, T_E >::insert_edges(), pgassert, pgr_alloc(), pgr_free(), pgr_msg(), pgr_randomSpanningTree(), UNDIRECTED, and AssertFailedException::what().
Referenced by process().