[R-sig-Geo] Distances in shortestPath function (package spatgraphs)

Julian Burgos julian at hafro.is
Mon Jun 18 13:20:27 CEST 2012


Dear list,

I have a question about the shortestPath function (in the package 
spatgraphs... a very useful package but with very sparse 
documentation).  The function finds the shortest connection between two 
nodes in a graph.  According to the documentation, the usage of the 
function is

shortestPath(i, j, g, pp=NULL, dbg=FALSE)

where i and j are the starting and ending nodes, g is the graph that 
defines de edges, and pp is a point pattern.  If pp is given, "the edges 
are of Euclidian length, otherwise each edge is of length 1.".

So this is my question:  if I give a point pattern, does the shortesPath 
function finds the shortest path in terms of distances between nodes or 
in terms of number of nodes?  In other words, will the algorithm select 
a shorter path in terms of distance even if it goes through a larger 
number of nodes?  I am asking because my graph  is very dense (has lots 
of points) in some areas, and it is very sparse in others.  I want to 
make sure that the algorithm actually picks the track with the shortest 
distance and not the track with the lowest number of nodes.
Thanks!

Julian

-- 
Julian Mariano Burgos, PhD
Hafrannsóknastofnunin/Marine Research Institute
Skúlagata 4, 121 Reykjavík, Iceland
Sími/Telephone : +354-5752037
Bréfsími/Telefax:  +354-5752001
Netfang/Email: julian at hafro.is



More information about the R-sig-Geo mailing list