Network.
count_per_link
(self, obs_on, graph=True)[source]¶Compute the counts per arc or edge (link).
Dictionary of observations on the network. Either {(link):{pt_id:(coords)}} or {link:[(coord),(coord),(coord)]}
{(link):count}
Examples
Note that this passes the obs_to_arc or obs_to_edge attribute of a point pattern snapped to the network.
>>> import spaghetti as spgh
>>> ntw = spgh.Network(examples.get_path('streets.shp'))
>>> ntw.snapobservations(examples.get_path('crimes.shp'),
... 'crimes',
... attribute=True)
>>> counts = ntw.count_per_link(ntw.pointpatterns['crimes']
... .obs_to_arc, graph=False)
>>> counts[(140, 142)]
10
>>> s = sum([v for v in list(counts.values())])
>>> s
287