compactness#

compactness(domain, network_name, edge_weight_name=None, population=None, include_boundaries=None, exclude_boundaries=None, boundary_exclude_distance=0)#

Computes the compactness of a spatial network.

Compactness is an index [0,1] describing a network is in terms of its area and length of edges.

The compactness of a spatial network measures how efficiently locations (nodes) within the network are connected in space. A spatial network with high compactness has short, direct connections between nodes, allowing for efficient movement or communication. This concept is commonly used to assess how well a system facilitates interactions across its spatial structure.

Parameters:
domainobject

The domain containing the network and objects.

network_namestr

The name of the network to evaluate.

edge_weight_namestr, optional

The name of the edge weight to use, by default None.

populationarray-like or query, optional

A query or array of object indices to filter the labels. Default is 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.

Returns:
float

An index [0,1] indicating the compactness of the network.

Raises:
RuntimeError

If the network name is not in the list of generated networks or if there is no edge weight named edge_weight_name within the network.

Notes

See reference: Barthelemy, Marc. Spatial Networks: A Complete Introduction: From Graph Theory and Statistical Physics to Real-World Applications. Springer Nature, 2022.