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', distance_weighted=True, inverse_distance_function=None, min_edge_distance=0, max_edge_distance=inf, number_of_nearest_neighbours=10, store_network=True)#

Generate 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).

distance_weightedbool, optional

Whether to weight edges by distance, by default True.

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