Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Get nodes representing dead ends in the street network.
These are not necessarily nodes with degree of 1, in the undirected representation of the street network,
Parameters
----------
network : nx.MultiDiGraph
A street network
Returns
-------
network : nx.MultiDiGraph
The same network, but without dead end nodes and edges
"""
if not 'streets_per_node' in network.graph:
network.graph['streets_per_node'] = ox.count_streets_per_node(network)
streets_per_node = network.graph['streets_per_node']
return [node for node, count in streets_per_node.items() if count <= 1]
Get nodes representing dead ends in the street network.
These are not necessarily nodes with degree of 1, in the undirected representation of the street network,
Parameters
----------
network : nx.MultiDiGraph
A street network
Returns
-------
network : nx.MultiDiGraph
The same network, but without dead end nodes and edges
"""
if not 'streets_per_node' in network.graph:
network.graph['streets_per_node'] = ox.count_streets_per_node(network)
streets_per_node = network.graph['streets_per_node']
return [node for node, count in streets_per_node.items() if count <= 1]