Spaghetti is an open-source Python library for the analysis of network-based spatial data. Originating from the network module in PySAL (Python Spatial Analysis Library), it is under active development for the inclusion of newly proposed methods for building graph-theoretic networks and the analysis of network events.
An example of a network's minimum spanning tree:
The following are a selection of some examples that can be launched individually as interactive binders from the links on their respective pages. Additional examples can be found in the Tutorials section of the documentation. See the
pysal/notebooks project for a
jupyter-book version of this repository.
As of version 1.5.3,
spaghetti officially supports Python 3.6, 3.7, 3.8, and 3.9. Please make sure that you are operating in a Python >= 3.6 environment.
conda-forge (highly recommended)
spaghetti and all its dependencies, we recommend using the
manager, specifically with the
conda-forge channel. This can be obtained by installing the
Anaconda Distribution (a free Python distribution for data science), or through
miniconda (minimal distribution only containing Python and the conda package manager).
spaghetti can be installed as follows:
$ conda config --set channel_priority strict $ conda install --channel conda-forge spaghetti
geopandas provides a nice example to create a fresh environment for working with spatial data.
$ pip install spaghetti
or download the source distribution (
.tar.gz) and decompress it to your selected destination. Open a command shell and navigate to the decompressed folder.
$ pip install .
When installing via
pip, you have to ensure that the required dependencies for
spaghetti are installed on your operating system. Details on how to install these packages are linked below. Using
conda (above) avoids having to install the dependencies separately.
Install the most current development version of
spaghetti by running:
$ pip install git+https://github.com/pysal/spaghetti