City2Graph Released: Python Library for Heterogeneous Graph Neural Networks in Urban Systems
Summary:City2Graph, an open-source Python library developed by Tough_Ad_6598, transforms geospatial data into analysis-ready graphs for spatial analysis, network analysis, and GeoAI applications. It supports heterogeneous data structures such as urban morphology, transportation networks, and proximity relationships, and integrates seamlessly with deep learning frameworks like PyTorch Geometric. The release of City2Graph offers a novel tool for urban data analysis and AI research, particularly excelling
City2Graph: Open-Source Python Library for Heterogeneous Graph Neural Networks in Urban Systems
City2Graph, developed by Tough_Ad_6598, is an open-source Python library designed to convert geospatial data into graph structures suitable for spatial analysis, network analysis, and GeoAI applications. Key features of the library include:
- Urban Morphology Analysis: Transforms building, street, and urban fabric data into heterogeneous graphs, supporting data import from sources like OpenStreetMap and Overture Maps.
- Transportation Network Processing: Loads GTFS and GBFS data via DuckDB and aggregates it into stop-to-stop transit graphs.
- Mobility Data Analysis: Handles OD matrices and flow data (e.g., migration, bike-sharing, pedestrian counts) as weighted spatial graphs.
- Proximity Relationship Computation: Supports various proximity calculations such as KNN, Delaunay, Gilbert, and Waxman, with options for Euclidean, Manhattan, and network distances.
- Heterogeneous Graphs and Meta-paths: Manages multiple node and edge types within a single graph and constructs cross-type relationships through meta-path derived edges.
- Data Conversion: Enables bidirectional conversion between GeoDataFrames, NetworkX, rustworkx, and PyTorch Geometric Data/HeteroData, preserving geometric and attribute information.
The library's design emphasizes treating urban data as heterogeneous graphs rather than flat feature tables, showcasing the interconnections between different constructs like morphology, transportation, mobility, and proximity. It maintains the integrity of graph structures and geometric information during data conversion, providing a robust tool for urban data analysis and AI research.
Technical Highlights
- Heterogeneous Graph Support: Capable of handling multiple node and edge types, adapting to the complexity of urban data.
- Seamless Integration: Integrates seamlessly with deep learning frameworks like PyTorch Geometric, facilitating AI model development.
- Multi-source Data Processing: Supports data import from various sources and offers flexible data conversion functionalities.
Industry Impact and Developer Recommendations
- Urban Data Analysis: Offers new methods for data processing and analysis in fields like urban planning and transportation management.
- AI Research: Provides a novel tool for GeoAI research, particularly excelling in handling the complexities of urban systems.
- Developer Recommendations: Developers are encouraged to focus on data preprocessing and graph structure design to maximize the library's potential. Active participation in community discussions is also recommended to propose new data source support requirements.
Paper Citation
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.
Original Link
https://www.reddit.com/r/MachineLearning/comments/1vn8oya/city2graph_a_python_library_for_heterogeneous/
Tags
- Heterogeneous Graph Neural Networks
- Urban Data Analysis
- GeoAI
- Open-Source Python Library
- Spatial Analysis
— END —Source: Reddit r/MachineLearning (2026-08-13)
Tags: #Heterogeneous Graph Neural Networks #Urban Data Analysis #GeoAI #Open-Source Python Library #Spatial Analysis
Editorial & Fact-Checking Note: This article is compiled from primary research, official release documentation, and source papers by the ZICQ Newsroom pipeline with automated entity verification and human editorial review. If you notice any technical inaccuracy, please submit a correction via our corrections policy or email our editorial desk directly.
Community Comments