Simulation Algorithm ImplementationsCore functions to perform a redistricting simulation 


SMC Redistricting Sampler 

'Flip' Markov Chain Monte Carlo Redistricting Simulation 

MergeSplit/Recombination MCMC Redistricting Sampler 

Redistricting Optimization through Short Bursts 

Extract the Metropolis Hastings Acceptance Rate 

Extract the sampling information from a redistricting simulation 

Redistricting via Compact Random Seed and Grow Algorithm 

Flip MCMC Redistricting Simulator 

Flip MCMC Redistricting Simulator using Simulated Annealing 

MCMC Redistricting Simulator using MPI 

Redistricting via Random Seed and Grow Algorithm 

Parallel MergeSplit/Recombination MCMC Redistricting Sampler 

Analysis FunctionsFunctions for analyzing simulation outputs 

A set of redistricting plans 

Add a reference plan to a set of plans 

Subset to sampled or reference draws 

Extract the matrix of district assignments from a redistricting simulation 

Extract the sampling weights from a redistricting simulation. 

Renumber districts to match a quantity of interest 

Pull back plans to unmerged units 

Renumber districts to match an existing plan 

Hierarchically classify a set of redistricting plans 

Make a comparison between two sets of plans 

Confidence Intervals for Importance Sampling Estimates 

Identify which counties are split by a plan 

Extract the last plan from a set of plans 

Calculate the diversity of a set of plans 

Plot a plan classification 

Extract the district assignments for a precinct across all simulated plans 

Compute a matrix of precinct cooccurrences 

Combine multiple sets of redistricting plans 

Calculate compactness measures for a set of plans 

Compute Competitiveness 

Compute Distance between Partitions 

Counts the Number of Counties within a District 

Calculate Group Percent by District 

Calculate gerrymandering metrics for a set of plans 

Counts the Number of Counties Split Between 3 or More Districts 

Calculates Maximum Deviation from Population Parity 

Segregation index calculation for MCMC redistricting. 

Count County Splits 

Setup HelpersFunctions that help prepare data and select constraints 

Create a 

Get and set the adjacency graph from a 

Extract the existing district assignment from a 

Get and set the population tolerance from a 

Extract the target district population from a 

Check that a 

Merge map units 

Plot a 

Coarsen Adjacency List 

Create Constraints for SMC 

Create County IDs 

Relabel Discontinuous Counties 

Find Majority Minority Remainder 

Run parameter testing for 

Freeze Parts of a Map 

Identify Cores of a District (Heuristic) 

Visualize VRA Penalty 

Reduce Adjacency List 

Sink Plans to 1:ndists 

Subset a shp 


Scoring function arithmetic 

Scoring functions for 
Plotting ToolsFunctions for creating plots and maps 

Plot a 

Summary plots for 

Diagnostic plotting functionality for MCMC redistricting. 

Creates a Graph Overlay 

Plot Cores 

Plot quantities by district 

Plot a histogram of a summary statistic 

Majority Minority Plots 

Plot a Map 

Plot a district assignment 

Scatter plot of plan summary statistics 

Static Variation of Information Plot 

DataData included to help demonstrate capabilities 

Florida 25 Precinct Shape File 

Florida 250 Precinct Shape File 

Florida 25 Precinct File 

All Partitions of 25 Precincts into 3 Congressional Districts (No Population Constraint) 

Florida 70 Precinct Shape File 

Iowa County File 

Post Processing HelpersFunctions that help setup outputs for easier use 

Combine successive runs of 

redist.combine.anneal 

Combine successive runs of 

Inverse probability reweighting for MCMC Redistricting 

Confidence Intervals for Importance Sampling Estimates 

Uncoarsen a District Matrix 

Enumeration ToolsFunctions for more involved enumeration choices 

Calculate Frontier Size 

Enumerate All Parititions 

Initialize enumpart 

Prepares a run of the enumpart algorithm by ordering edges 

Read Results from enumpart 

Runs the enumpart algorithm 

MiscellaneousOther functions 

Simulation Methods for Legislative Redistricting 

Extract the redistricting matrix from a 

Flip Constraints Helper 

Local Plan Optimization 

Pick One Plan from Many Plans 

Print legacy redist objects 

Print redist_classified objects 

Generic to print redist_map 

Print method for redist_plans 

Adjacency List functionality for redist 

Compare the Population Overlap Across Plans at the District Level 

Display an interactive map 

Compare the Population Overlap Across Plans at the Precinct Level 

Prep Polsby Popper Perimeter Dataframe 

Return a random subgraph of a shape 

Reorders district numbers 

Helper function to truncate importance weights 