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.
If you use PySAL-spaghetti in a scientific publication, we would appreciate using the following citation:
Bibtex entry:
@misc{Gaboardi2018, author = {Gaboardi, James D. and Laura, Jay and Rey, Sergio and Wolf, Levi John and Folch, David C. and Kang, Wei and Stephens, Philip and Schmidt, Charles}, month = {oct}, year = {2018}, title = {pysal/spaghetti}, url = {https://github.com/pysal/spaghetti}, keywords = {graph-theory,network-analysis,python,spatial-networks,topology} }
As of version 1.3, spaghetti supports Python 3.6 and 3.7 only. Please make sure that you are operating in a Python 3 environment.
conda
via spaghetti-feedstock (highly recommended)¶To install spaghetti
and all its dependencies, we recommend using the conda 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).
Using conda, spaghetti can be installed as follows:
$ conda config --set channel_priority strict
$ conda install --channel conda-forge spaghetti
$ 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 .
Warning
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 here. 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
Install the most current development version of spaghetti by running:
$ pip install git+https://github.com/pysal/spaghetti
You can also fork the pysal/spaghetti repo and create a local clone of your fork. By making changes to your local clone and submitting a pull request to pysal/spaghetti, you can contribute to the spaghetti development.
|
Extract connected component information from a |
Using the existing network representation, create a graph-theoretic representation by removing all vertices with a neighbor incidence of two (non-articulation points). |
|
|
Create a contiguity-based libpysal W object. |
Create distance based weights. |
|
|
Snap a point pattern shapefile to network object. |
Given an observation on a network arc, return the distance to the two vertices that bound that end. |
|
|
Given an observation snapped to a network arc, calculate the distance from the original location to the snapped location. |
|
Compute the counts per arc or edge (link). |
Generate a simulated point pattern on the network. |
|
|
Returns the arcs (links) around vertices. |
All vertex-to-vertex distances on a network. |
|
Compute either all distances between |
|
Compute the interpattern nearest neighbor distances or the intrapattern nearest neighbor distances between a source pattern and a destination pattern. |
|
|
Split all of the arcs in the network at either a |
|
Save a network to disk as a binary file. |
|
Load a network from a binary file saved on disk. |
|
Computes a network constrained F-Function |
|
Computes a network constrained G-Function |
|
Computes a network constrained K-Function |
|
Evaluate one connected component in a network for non-articulation points (napts) and return an updated set of napts and unvisted vertices. |
Used internally to extract a network from a polyline shapefile of a |
|
|
Used internally to compute new point coordinates during snapping. |
|
Used internally to round the vertex to a set number of significant digits. |
|
Used internally to snap point observations to network arcs. |
Find all nodes with degree 2 that are not in an isolated island ring (loop) component. |
|
|
Used internally, this method traverses a bridge arc to find the source and destination nodes. |
|
A stub point pattern class used to store a point pattern. |
Struct style class to mirror the |
|
Return a geopandas.GeoDataFrame of network elements.This can be (a) the vertices of a network; (b) the arcs of a network; (c) both the vertices and arcs of the network; (d) raw point pattern associated with the network; or (e) snapped point pattern of (d).. |
E. W. Dijkstra. A Note on Two Problems in Connexion with Graphs. Numerische Mathematik, 1(1):269–271, 1959. doi:10.1007/BF01386390.
Atsuyuki Okabe and Ikuho Yamada. The K-Function Method on a Network and Its Computational Implementation. Geographical Analysis, 33(3):271–290, 2001.