iduedu.local_stats

iduedu.local_stats(urban_graph, radius, *, weight='length_meter', nodes=None, edge_types=None, max_workers=None)[source]

Network measures around every node, within a travel cost along the network.

For each node the nodes reachable within radius are collected with a cut-off shortest-path search, and the streets are counted through them: every street gives half of its length to each of its two ends.

Parameters:
  • urban_graph (UrbanGraph) – Graph in a projected (metric) CRS.

  • radius (Union[float, Iterable[float]]) – Network radius, or several radii, in the units of weight (metres by default).

  • weight (str) – Edge column that measures the radius: "length_meter" or "time_min".

  • nodes (Optional[Iterable[Any]]) – Nodes to measure; by default every node. The search always runs on the whole graph.

  • edge_types (Optional[Iterable[str]]) – Count only the streets whose type is one of these. The search still uses every edge.

  • max_workers (int | None) – Number of threads; None uses all cores.

Return type:

DataFrame

Returns:

DataFrame indexed by node id. For every radius r the columns node_count_r, intersection_count_r, dead_end_count_r, street_length_r (metres), streets_per_node_mean_r, dead_end_share_r and intersections_per_km_r (intersections per kilometre of street). The node itself is included.

Raises:

ValueError – If the CRS is geographic, radius is invalid or a node is absent from the graph.