iduedu.iter_od_matrix

iduedu.iter_od_matrix(urban_graph, *, gdf_origins=None, gdf_destinations=None, origins_nodes=None, destination_nodes=None, graph_node_column='graph_node_id', weight='time_min', dtype=<class 'numpy.float32'>, threshold=None, max_workers=None, cutoff=None, output='distances', path_storage='eager', mode='all_to_all', batch_size=256, method='auto', distance_format='frame')[source]

Yield OD results in origin-row blocks, using the same options as od_matrix.

batch_size is the number of input origin rows per yielded block. In pairwise mode the corresponding destination rows are sliced too. Object-to-node matching is done once. Consume and release blocks to bound retained memory; collecting them all retains all tables/trees. Do not edit the graph while consuming an iterator. Validation occurs when iteration starts.

Each block uses the selected distance_format. With output="both", blocks are ShortestPathResult objects with distances in that format and pandas paths. Pairwise mode supports "frame" and "dense".

Return type:

Iterator[Series | DataFrame | ShortestPathResult | ndarray | csr_array]

Parameters:
  • urban_graph (UrbanGraph)

  • gdf_origins (DataFrame | None)

  • gdf_destinations (DataFrame | None)

  • origins_nodes (Iterable[Any] | None)

  • destination_nodes (Iterable[Any] | None)

  • graph_node_column (str)

  • weight (Literal['length_meter', 'time_min'])

  • dtype (dtype)

  • threshold (float | None)

  • max_workers (int | None)

  • cutoff (float | None)

  • output (Literal['distances', 'paths', 'both'])

  • path_storage (Literal['eager', 'lazy'])

  • mode (Literal['all_to_all', 'pairwise'])

  • batch_size (int)

  • method (Literal['auto', 'bidirectional', 'astar', 'dijkstra'])

  • distance_format (Literal['frame', 'dense', 'sparse'])