22 #include <grass/dgl/graph.h> 52 for (i = 1; i <= nnodes; i++) {
62 for (i = 0; i < from->
n_values; i++) {
63 int v = from->
value[i];
89 if (have_node_costs && prev[v]) {
108 if (dst[to_id] < 0 || dst[to_id] > dist + d) {
109 dst[to_id] = dist + d;
111 heap_data.
ul = to_id;
152 for (i = 1; i <= nnodes; i++) {
158 G_warning(
"Directed graph must be version 2 or 3 for NetA_distance_to_points()");
167 for (i = 0; i < to->
n_values; i++) {
168 int v = to->
value[i];
188 dist = heap_node.
key;
194 if (have_node_costs && nxt[v]) {
213 if (dst[from_id] < 0 || dst[from_id] > dist + d) {
214 dst[from_id] = dist + d;
216 heap_data.
ul = from_id;
253 int begin, end, cur, nnodes;
260 vis = (
char *)
G_calloc(nnodes + 1,
sizeof(
char));
261 if (!prev || !queue || !vis) {
275 while (begin != end) {
283 if (have_node_costs && prev[vertex]) {
299 if (edges[edge_id] && !vis[node_id]) {
301 prev[node_id] = edge;
302 queue[end++] = node_id;
315 while (prev[cur] !=
NULL) {
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
dglInt32_t * dglGetNode(dglGraph_s *pGraph, dglInt32_t nNodeId)
int Vect_reset_list(struct ilist *)
Reset ilist structure.
int NetA_distance_to_points(dglGraph_s *graph, struct ilist *to, int *dst, dglInt32_t **nxt)
Computes shortest paths from every node to nodes in "to".
dglInt32_t dglNodeGet_Id(dglGraph_s *pGraph, dglInt32_t *pnNode)
dglInt32_t dglEdgeGet_Cost(dglGraph_s *pGraph, dglInt32_t *pnEdge)
void dglHeapFree(dglHeap_s *pheap, dglHeapCancelItem_fn pfnCancelItem)
int n_values
Number of values in the list.
void G_free(void *)
Free allocated memory.
dglInt32_t * dglEdgeGet_Head(dglGraph_s *pGraph, dglInt32_t *pnEdge)
int dglGet_NodeCount(dglGraph_s *pgraph)
void dglHeapInit(dglHeap_s *pheap)
dglInt32_t * dglEdgeGet_Tail(dglGraph_s *pGraph, dglInt32_t *pnEdge)
dglInt32_t * dglEdgeset_T_First(dglEdgesetTraverser_s *pT)
void dglEdgeset_T_Release(dglEdgesetTraverser_s *pT)
int Vect_list_append(struct ilist *, int)
Append new item to the end of list if not yet present.
void G_warning(const char *,...) __attribute__((format(printf
dglInt32_t * dglNodeGet_Attr(dglGraph_s *pGraph, dglInt32_t *pnNode)
int * value
Array of values.
dglInt32_t * dglNodeGet_InEdgeset(dglGraph_s *pGraph, dglInt32_t *pnNode)
int dglHeapInsertMin(dglHeap_s *pheap, long key, unsigned char flags, dglHeapData_u value)
int dglHeapExtractMin(dglHeap_s *pheap, dglHeapNode_s *pnoderet)
dglInt32_t * dglEdgeset_T_Next(dglEdgesetTraverser_s *pT)
dglInt32_t * dglNodeGet_OutEdgeset(dglGraph_s *pGraph, dglInt32_t *pnNode)
int dglEdgeset_T_Initialize(dglEdgesetTraverser_s *pT, dglGraph_s *pGraph, dglInt32_t *pnEdgeset)
dglInt32_t dglEdgeGet_Id(dglGraph_s *pGraph, dglInt32_t *pnEdge)
int NetA_distance_from_points(dglGraph_s *graph, struct ilist *from, int *dst, dglInt32_t **prev)
Computes shortest paths to every node from nodes in "from".
int dglGet_NodeAttrSize(dglGraph_s *pgraph)
int NetA_find_path(dglGraph_s *graph, int from, int to, int *edges, struct ilist *list)
Find a path (minimum number of edges) from 'from' to 'to' using only edges flagged as valid in 'edges...