momepy.stroke_spacing

momepy.stroke_spacing(stroke_graph)[source]

Computes the stroke’s spacing. Spacing is defined as the average length between connections for a stroke.

Adapted from [El Gouj et al., 2022].

Parameters:
stroke_graph : nx.Graph()

Stroke graph of a network, generated with momepy.coins_to_nx().

Returns:

stroke_graph – Returns stroke_graph where each node has acquired the additional attribute stroke_spacing; and the additional attribute stroke_connectivity (unless it has been present in the input graph).

Return type:

nx.Graph()

Examples

>>> stroke_graph = stroke_spacing(stroke_graph)