momepy.
cyclomatic
(graph, radius=5, name='cyclomatic', distance=None)[source]¶Calculates cyclomatic complexity for subgraph around each node.
Subgraph is generated around each node within set radius. If distance=None, radius will define topological distance, otherwise it uses values in distance attribute.
where \(e\) is the number of edges in subgraph and \(v\) is the number of nodes in subgraph.
Graph representing street network.
Ideally genereated from GeoDataFrame using momepy.gdf_to_nx()
number of topological steps defining the extent of subgraph
calculated attribute name
Use specified edge data key as distance. For example, setting distance=’weight’ will use the edge weight to measure the distance from the node n.
networkx.Graph
References
Bourdic L, Salat S and Nowacki C (2012) Assessing cities: a new system of cross-scale spatial indicators. Building Research & Information 40(5): 592–605.
Examples
>>> network_graph = mm.cyclomatic(network_graph, radius=3)