pysal.explore.spaghetti.get_neighbor_distances

pysal.explore.spaghetti.get_neighbor_distances(ntw, v0, l)[source]

Get distances to the nearest node neighbors along connecting edges.

Parameters:
ntw : spaghetti.Network

spaghetti Network object.

v0 : int

Node id

l : dict

key is tuple (start node, end node); value is float. Cost per edge to travel, e.g. distance.

Returns:
neighbors : dict

key is int (node id); value is float (distance)

Examples

>>> import pysal.explore.spaghetti as spgh
>>> from pysal.lib import examples
>>> ntw = spgh.Network(examples.get_path('streets.shp'))
>>> neighs = spgh.util.get_neighbor_distances(ntw, 0, ntw.edge_lengths)
>>> neighs[1]
102.62353453439829