City2Graph: A Python library for Heterogeneous Graph Neural Networks and spatial analysis in urban systems [R]
Our take
![City2Graph: A Python library for Heterogeneous Graph Neural Networks and spatial analysis in urban systems [R]](https://preview.redd.it/4vi2d3zjt4jh1.png?width=140&height=75&auto=webp&s=449a7301e08aaa1e20ce77f1b29141f588abf034)
The emergence of City2Graph, a Python library facilitating the transformation of geospatial data into analysis-ready graphs, represents a significant step forward for urban systems research and application. Traditional approaches often treat urban data as flat feature tables, limiting the ability to capture complex spatial relationships and dependencies. However, as explored in "How to Place Vertiport Locations in Any City Using Geospatial Machine Learning," the power of geospatial machine learning hinges on understanding these intricate connections. City2Graph directly addresses this limitation by enabling the creation of heterogeneous graphs—integrating buildings, streets, mobility patterns, and proximity data—allowing for a more holistic and nuanced understanding of urban environments. This shift aligns with a broader trend toward leveraging graph neural networks (GNNs) to model complex systems, a trend also highlighted in "Four of five enterprises that secured AI agent identities still can't contain one that goes rogue," where understanding agent interactions and dependencies is critical.
City2Graph’s versatility is particularly compelling. The library's ability to seamlessly convert between various data formats – GeoDataFrames, NetworkX, rustworkx, and PyTorch Geometric – streamlines workflows and promotes interoperability. Features like the incorporation of GTFS and GBFS feeds for transit analysis, alongside mobility data like OD matrices and pedestrian counts, demonstrate a clear focus on practical applications. The inclusion of proximity and contiguity analyses, utilizing various distance metrics, further expands its utility. The author’s emphasis on maintaining geometry and attributes throughout these conversions is crucial for ensuring data integrity and accuracy – a vital consideration in any spatial analysis endeavor. The design allows researchers to explore complex relationships between urban elements, moving beyond simple correlations to uncover deeper insights into urban dynamics.
The open-source nature of City2Graph, coupled with the invitation for contributions and feedback, fosters a collaborative environment that will undoubtedly accelerate its development and adoption. The library’s focus on supporting diverse data sources is particularly encouraging, signaling a commitment to addressing the evolving needs of the urban data community. Considering the challenges of integrating diverse datasets, as evidenced by the complexities addressed in "Rivian CEO RJ Scaringe is betting on EVs, robots, and autonomy all at once — he’ll explain why at Disrupt 2026," City2Graph’s modular design and conversion capabilities offer a valuable solution for researchers and practitioners alike. The explicit citation provided in the paper underscores the library's potential to become a standard tool in the field.
Looking ahead, the success of City2Graph will depend on its continued ability to adapt to new data sources and analytical techniques. The focus on heterogeneous graph neural networks suggests a future where urban planning, transportation management, and resource allocation are increasingly informed by data-driven insights derived from graph-based models. A key question to watch is how this library will be integrated with real-time urban data streams, enabling dynamic analysis and adaptive decision-making. The potential for City2Graph to unlock deeper understandings of urban systems, and facilitate more intelligent urban design, is considerable.
| City2Graph is a Python library I built that turns geospatial data into analysis-ready graphs, and the paper describing it has just been published, so I wanted to share it here. What it covers:
It sets out why urban data is better treated as heterogeneous graphs than as flat feature tables, how the morphological, transport, mobility, and proximity constructions relate to each other, and how the library keeps geometry and graph structure consistent across conversions. If you use the library in research, that is the citation. Paper Sato, Y., Pietrostefani, E., Mahabir, R., & Arribas-Bel, D. (2026). City2Graph: A Python library for Heterogeneous Graph Neural Networks and spatial analysis in urban systems. Computers, Environment and Urban Systems, 130, 102492. Happy to answer questions about the design, and issues or PRs are very welcome. I am especially keen to hear which data sources people want supported next. [link] [comments] |
Read on the original site
Open the publisher's page for the full experience