spacenet.helpers#

Helper functions for spatial networks#

get_edge_weights

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

get_nodes_and_labels

A function to extract node indices and labels from a spatial network.

get_node_node_distance

Retrieves node-node distance information from a spatial network's distance cache for a specified weight attribute and an optional subset of source nodes.

node_node_distance

Computes the shortest path distances from a set of source nodes to all other nodes in a spatial network, with optional caching to avoid redundant computations.

update_node_node_distance_cache

Update the node-node distance cache in the spatial network with new distances for a given weight and limit.

remove_nodes_from_distance_cache

Removes specified nodes from the distance cache of a spatial network.

shortest_path_length_node_a_to_node_b

Computes the shortest path distance from node_a to node_b in a spatial network using Dijkstra's algorithm, with the specified edge weight.

clear_distance_cache

Clear the distance cache of a spatial network.

batched_dijkstra

Compute shortest path distances from multiple source nodes to all other nodes in the graph using Dijkstra's algorithm in batches.