A high-performance implementation of GerryChain in Julia
Author mggg
9 Stars
Updated Last
1 Year Ago
Started In
February 2020


Build and Test status Code Coverage DOI

GerryChain is a Julia package for building ensembles of districting plans using Markov Chain Monte Carlo techniques. It is developed and maintained by the Metric Geometry and Gerrymandering Group and our network of volunteers. We also have a Python package of the same name.

The basic workflow is to start with the geometry of an initial plan and generate a large collection of sample plans for comparison. Usually, we will constrain these sampled plans in such a way that they perform at least as well as the initial plan according to traditional districting principles, such as population balance or compactness. Comparing the initial plan to the ensemble provides quantitative tools for measuring whether or not it is an outlier among the sampled plans.

Getting set up

If you already have Julia installed, then installing GerryChain is easy using Julia's in-built package manager Pkg.

using Pkg; Pkg.add("GerryChain")
using GerryChain

If you need to install Julia, use Julia in Jupyter Notebooks or use learn how to use GerryChain in a specific virtual environment, head over to our more detailed setup instructions.

Useful links

Please refer to our documentation pages for API references.

Follow this link if you want to get started on your first chain already.

If you want to contribute to this project, please check our contributing guidelines.

If you have any issues or requests, please do not hesitate to raise an issue.


You can cite the Recombination algorithm as

    title={Recombination: A family of Markov chains for redistricting},
    author={Daryl DeFord and Moon Duchin and Justin Solomon},

The current version of the code can be cited as

  author       = {Parker Rule and
                  Matthew Sun and
                  Bhushan Suwal
  title        = {mggg/GerryChainJulia: Minor fixes + Save as HDF5},
  month        = mar,
  year         = 2021,
  publisher    = {Zenodo},
  version      = {v0.1.3},
  doi          = {10.5281/zenodo.4649464},
  url          = {}