GRASS GIS 8 Programmer's Manual
8.4.0dev(2024)55b2a2bccc

Network Analysis library  shortest path. More...
#include <stdio.h>
#include <stdlib.h>
#include <grass/gis.h>
#include <grass/vector.h>
#include <grass/glocale.h>
#include <grass/dgl/graph.h>
#include <grass/neta.h>
Go to the source code of this file.
Functions  
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". More...  
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". More...  
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'. Edge costs are not considered. Closed nodes are not traversed. More...  
Network Analysis library  shortest path.
Shortest paths from a set of nodes.
(C) 20092010 by Daniel Bundala, and the GRASS Development Team
This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.
Definition in file vector/neta/path.c.
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".
Array "dst" contains the cost of the path or 1 if the node is not reachable. Prev contains edges from predecessor along the shortest path.
graph  input graph  
from  list of 'from' positions  
[out]  dst  array of costs to reach nodes 
[out]  prev  array of edges from predecessor along the shortest path 
Definition at line 40 of file vector/neta/path.c.
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".
Array "dst" contains the cost of the path or 1 if the node is not reachable. Nxt contains edges from successor along the shortest path. This method does reverse search starting with "to" nodes and going backward.
graph  input graph  
to  list of 'to' positions  
[out]  dst  array of costs to reach nodes 
[out]  nxt  array of edges from successor along the shortest path 
Definition at line 138 of file vector/neta/path.c.
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'. Edge costs are not considered. Closed nodes are not traversed.
Precisely, edge with id I is used if edges[abs(i)] == 1. List stores the indices of lines on the path. The method returns the number of edges or 1 if no path exists.
graph  input graph  
from  'from' position  
to  'to' position  
edges  array of edges indicating whether an edge should be used  
[out]  list  list of edges 
Definition at line 244 of file vector/neta/path.c.