Skip to content

Tools for obtaining adjacency graphs from polygon shapefile data

Notifications You must be signed in to change notification settings

gerrymandr/adjacency-graphs

Repository files navigation

The Adjacency Graphs Project

CircleCI

About

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)

Pennsylvania Graph

Quickstart

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

Contributing

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.

Documentation

Please document future updates to this project in the MGGG Software Guide

About

Tools for obtaining adjacency graphs from polygon shapefile data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages