--- id: spaghetti version: "1.7.6" license: BSD 3-Clause license_treatment: permissive maintenance: active --- # spaghetti — Analysis of Network-constrained Spatial Data License: permissive · Maintenance: active · Downloads: 101.1K/mo ## What it is and what it does Spaghetti is a Python library for analyzing spatial networks—geographic data structured as graphs of connected line segments and nodes. It originated from PySAL's network module and provides tools for building networks from geographic features, computing network topology, finding shortest paths, and analyzing network events within a spatial context. The library integrates tightly with the PySAL ecosystem, allowing users to combine network analysis with spatial statistics (via esda), spatial weights (via libpysal), and geospatial operations (via geopandas and shapely). The package is designed for spatial data scientists and researchers studying network-centric phenomena—transportation networks, utility grids, social networks with geographic constraints, and similar structures where both topology and location matter. It depends on eight runtime packages including numpy, scipy, geopandas, and rtree, making it part of a larger geospatial Python stack rather than a standalone tool. Installation via conda-forge is recommended to avoid manual system dependency setup. Use it for: - Analyze transportation networks to find shortest routes or identify bottlenecks in road or transit systems. - Study utility infrastructure (power grids, water pipes) as spatial graphs to detect network fragmentation. - Compute network-constrained distances for spatial statistical tests that account for connectivity. - Build minimum spanning trees from geographic point or line data for network design problems. - Integrate network topology with spatial weights for neighborhood analysis along network edges. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Spaghetti analyzes network-based spatial data by building graph-theoretic networks from geographic features and computing network events, topology, and spatial inference on them. Yes, if you work with geographic networks and need graph-theoretic analysis integrated with spatial statistics. The package is actively maintained, has no known vulnerabilities, and fits naturally into the PySAL ecosystem. Install via conda-forge to avoid dependency friction. Not necessary if you only need basic graph algorithms without spatial context. ## Install pip install spaghetti uv add spaghetti poetry add spaghetti ## Installing spaghetti Before you install: Low friction: pure Python wheel with no compiled dependencies beyond the spatial stack (geopandas, shapely, rtree, scipy). Active maintenance as of July 2026 with regular releases since 2018. License in practice: BSD 3-Clause is permissive; you can use, modify, and distribute spaghetti freely in commercial and private projects provided you retain the license notice. Quickstart: import spaghetti import geopandas as gpd # Load a GeoDataFrame of network geometries net = spaghetti.Network(gdf.geometry) # Compute shortest path or analyze network topology path = net.shortest_path(source, target) Requires Python >= 3.10 and libspatialindex system library (installed automatically via conda, manual install required for pip on some systems). Verify before relying: - Whether the package supports dynamic network updates or only static graph construction. - Performance characteristics on large networks (node/edge count thresholds). - Availability of specialized algorithms beyond shortest path and spanning tree. ## Package facts - License: BSD 3-Clause (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 101.1K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags spatial network analysis, graph-based geographic data, network topology spatial, shortest path networks, spatial graph algorithms, network-constrained analysis, geographic network events, spatial-networks, graph-analysis, gis [View on SkillFed](https://skillfed.io/packages/spaghetti) · [View on PyPI](https://pypi.org/project/spaghetti/)