This is a project for managing Adjacency Graphs in python. There are package components for algorithms to generate adjacency maps from shapefiles, make plots from the result and export graphs. Once the package is installed, you can quickly build an adjacency graph with one of our built-in algorithms as follows:
from adjacency_graphs.algorithms import TwoStepGraph
shp_path = '/path/to/shape.shp'
geoid_column_name = 'column_name'
my_graph = TwoStepGraph(shp_path, geoid_column)
We recommend usage of Conda or virtualenv to work with this software. Directions for setting up conda are at https://conda.io/docs/user-guide/install/index.html
We'll proceed here with directions for conda for the virtual environment, but we'll use pip to install our packages.
We don't have this package on PyPI yet. To install, download or clone the project:
git clone https://github.com/msarahan/state-adjacency-graphs
cd state-adjacency-graphs
We include the environment definition that conda should create in the environment.yml file. That's why we ask you to download the source first.
conda env create
source activate adj
Note: on Windows, omit "source" in the line above.
The python package can then be installed by running the command
pip install .
That will install the adjacency_graphs
package and all of the dependencies. To
see if the package has correctly installed, run
python examples/example_pipeline.py
There is a guide for first time contributors to this project. This project is a fork (with history rewritten to reduce size) from the original state-adjacency-graphs and would not have been possible without contributions from the Austin Gerrymandering Hackathon. A full contributors list can be found at contributors.txt.
Please document future updates to this project in the MGGG Software Guide