spacenet.helpers.get_edge_weights#

spacenet.helpers.get_edge_weights(network, weight='Distance')#

Extracts edge weights from a spatial network for a specified weight attribute and returns them as a numpy array.

Parameters:
networknetworkx.Graph

The spatial network from which to extract edge weights. Edges should have a weight attribute corresponding to the distance between nodes.

weightstr, optional

The name of the edge attribute in the network that corresponds to the distance between nodes. Default is ‘Distance’.

Returns:
edge_weightsnumpy.ndarray

An array of edge weights corresponding to the specified weight attribute for each edge in the network.