executing-plans
executing-plans
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available
mobility-and-transportBuild spatial OD mobility graphs and local GTFS/GBFS transportation graphs with explicit schemas, service windows, time semantics, and DuckDB spatial prerequisites.
Independent GitHub snapshot · Automated classification · Original documentation governs
Use this skill when the task is to turn an existing origin-destination (OD)
data set, a local GTFS schedule archive, or a local GBFS JSON directory into
city2graph graph data. The package is GeoDataFrame-first: prefer returning
(nodes_gdf, edges_gdf) and convert that pair with city2graph.utils.gdf_to_nx
only when a NetworkX consumer explicitly requires it.
This skill covers:
city2graph.mobility.od_matrix_to_graph for OD edge lists and adjacency
matrices/arrays;city2graph.transportation.load_gtfs and load_gbfs for local feed
ingestion;get_od_pairs for dated, stop-to-stop GTFS legs; andtravel_summary_graph for an aggregated stop-level service graph.It does not download feeds, query a live transit API, geocode locations, or
construct a road-routing network. All workflows can be exercised with local
files or an in-memory DuckDB connection. A local/cached DuckDB spatial
extension is still required for geometry-producing transit workflows; a first
attempt to INSTALL spatial can itself require package access, so do not claim
an offline environment is ready until that extension is available.
| Starting data | Entry point | Result |
|---|---|---|
| Edge-list OD flows plus zone geometries | od_matrix_to_graph(..., matrix_type="edgelist") | Spatial zone nodes and weighted OD edges |
| Labeled adjacency DataFrame | od_matrix_to_graph(..., matrix_type="adjacency") | Spatial zone nodes and non-zero adjacency edges |
| NumPy adjacency array | Same, with matrix_type="adjacency" | Array rows/columns mapped to zone order |
Local .zip GTFS schedule | load_gtfs(path) | In-memory DuckDB tables |
| GTFS connection and individual legs needed | get_od_pairs(con, ...) | One row per consecutive stop leg/date |
| GTFS connection and an aggregate network needed | travel_summary_graph(con, ...) | Stop nodes and service-weighted summary edges |
| Local GBFS JSON directory | load_gbfs(path) | In-memory DuckDB tables; no transit summary is inferred |
Do not treat GBFS station/bike/vehicle tables as GTFS stops, trips, or
stop_times; load_gbfs is an ingestion primitive, not a graph builder.
The installed package exposes these functions both from their modules and via the package-level re-export:
from city2graph.mobility import od_matrix_to_graph
from city2graph.transportation import (
get_od_pairs,
load_gbfs,
load_gtfs,
travel_summary_graph,
)
Important defaults:
od_matrix_to_graph: matrix_type="edgelist", source_col="source",
target_col="target", directed=True, include_self_loops=False,
compute_edge_geometry=True, and GeoDataFrame output.get_od_pairs: include_geometry=True, directed=False.travel_summary_graph: no time/date bounds, directed=False,
use_frequencies=True, and GeoDataFrame output.load_gtfs accepts a local path to a ZIP archive; load_gbfs accepts a local
directory and recursively reads *.json files.The exact signatures are kept in the bundled workflow references. If a caller
passes as_nx, emit/expect the package deprecation warning: as_nx is a
legacy compatibility path and is not the recommended interface.
references/troubleshooting.md.use_frequencies for transit.Before handing a graph to a downstream analysis:
source,target for OD and
from_stop_id,to_stop_id for summary transit edges).YYYYMMDD and time strings are HH:MM:SS,
including extended hours such as 25:30:00 where appropriate.as_nx warning is treated as migration work, not suppressed as a
durable API choice.