generate_network#
- generate_network(domain, network_name='default_network', objects_as_nodes=None, include_boundaries=None, exclude_boundaries=None, boundary_exclude_distance=0, network_type='Delaunay', inverse_distance_function=None, min_edge_distance=0, max_edge_distance=inf, number_of_nearest_neighbours=10, store_network=True)#
Generate a spatial network using the domain objects. Network is stored within the domain class for future use. Nodes are indexed using Object ID.
- Parameters:
- domainobject
The domain containing the objects to be used for network generation.
- network_namestr, optional
The name of the network, by default ‘default_network’.
- objects_as_nodesarray-like, query-like, or None, optional
The objects_as_nodes to select specific objects, by default None.
- include_boundariesarray-like, query-like, or None, optional
Boundaries to include in the analysis. Defaults to None.
- exclude_boundariesarray-like, query-like, or None, optional
Boundaries to exclude from the analysis. Defaults to None.
- boundary_exclude_distancefloat, optional
Buffer to exclude objects located within boundary_exclude_distance from the boundaries. Defaults to 0.
- 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.
- store_networkbool, optional
Whether to store the network in the domain, by default True.
- Returns:
- networkx.Graph
The generated network. KNN networks will return a directed network (networkx.DiGraph).
- Raises:
- ValueError
If the network type is not implemented or if the objects_as_nodes is of incorrect type.
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.