spacenet.utils.generate_spatial_network#
- spacenet.utils.generate_spatial_network(points, network_type='Delaunay', inverse_distance_function=None, min_edge_distance=0, max_edge_distance=inf, number_of_nearest_neighbours=10)#
Generate a spatial network using set of points. Edges will be created between objects based on the selected network type and distance constraints. Edge weights for ‘Distance’ and ‘Inverse Distance’ will be added to the network. Node indices correspond to the indices of the input points array.
- Parameters:
- pointsnp.array
An array of coordinates relating to the spatial location of each node to be used for network generation.
- network_typestr, optional
The type of network to generate. Options are ‘Delaunay’ (Delaunay triangulation), ‘KNN’ (K-nearest neighbour), ‘Proximity’ and ‘RNG’ (relative neighbourhood graph).
- inverse_distance_functioncallable, optional
Function to compute inverse distance, by default None.
- min_edge_distancefloat, optional
Minimum edge distance, by default 0.
- max_edge_distancefloat, optional
Maximum edge distance, by default np.inf.
- number_of_nearest_neighboursint, optional
Number of nearest neighbours for KNN. Only used for KNN networks, by default 10.
- Returns:
- networkx.Graph
The generated network. KNN networks will return a directed network (networkx.DiGraph).
Notes
Delaunay networks estimates a natural geometric triangulation for pointclouds. In spatial applications, a Delaunay network approximates contact-based connectivity using only centroid data. See Delaunay networks for more information.
K-Nearest Neighbours (KNN) networks estimates the local connectivity of points in space by connecting any object to it’s k closest objects. See KNN networks for more information.
Proximity networks define connectivity purely by distance thresholds. See Proximity networks for more information.
Relative Neighbourhood Graph (RNG) esimtates the natural connectivity of points in space. MuSpAn implements the Urquhart approximation to the RNG for computational efficiency. See RNGs for more information.
Examples
Example of generating a Delaunay network from all objects in the domain:
# To complete later...