A New Redistricting Algorithm
Chris Larson

Before I get into how this algorithm works, feel free to explore the current federal districts in Michigan and compare them to the proposed districts below.

If you'd like a full rundown of the motivations and method, you can read about it in detail on Medium.

A computer algorithm seems like our best solution to eliminate as much bias as possible when it comes to creating voting maps. Here are some existing algorithms that all eliminate any bias by not using demographic data, which makes them good solutions in their own right. But there are still some issues with each that can be addressed.

#### Shortest-Splitline

The rules of this algorithm use only the population distribution and geographic shape of the state to create district maps.

But problems arise when finding districts in densely populated urban areas. It tends to break them up indiscriminately. Other examples can be found here.

#### Shortest Average Distance to the Center of a District

This algorithm uses US Census blocks to create districts where people have the lowest average distance to the center of their district.

The primary advantage of this method is that it creates fairly round and compact districts.

The goal of this approach is to improve constituents' access to voting centers by creating districts with the shortest possible travel times to reach the center. I really like this approach, but it still has the same problem of potentially breaking up larger populations indiscriminately. My understanding is that this is mitigated by an element of randomness, which leads to a human choosing from a set of maps for the best maps. This introduces an element of bias into the system.

A great explanation of the process can be found here.

### The Proposed Algorithm

Evenly split a state into the required number of districts by using county lines and population borders while keeping districts as compact as possible. Splitting is done by finding the lowest population paths through each county.

#### Rules the method follows

Keep communities together
By using the 2010 US Census data, this method creates a population density graph using individual census blocks (the smallest census unit). The state is initially split using county lines in order to utilize an already familiar border for most constituents.

But we can’t form voting districts just from counties. They are much too large for the accuracy required. Especially because the US government requires each federal voting district to be accurate to a single voter. Using the 2010 census data, Michigan needs 14 federal districts and each of those districts need to contain 705,974 people.

That means we need another way to break up counties into smaller pieces. This algorithm creates those splits using a form of dynamic programming used in image analysis. It finds the lowest population path through a group of census blocks, and by doing so, it avoids breaking apart communities as much as possible.

The animation above is finding the lowest population seam through a county. It finds the lowest population path through this county by evaluating its neighbors. The heat map shows population energy as measured from north to south. And then the algorithm works back south to north to find the best seam. Green blocks represent the lowest energy seam, purple blocks are the possible candidates from the current end of the seam, and orange blocks are the lowest energy candidate.

In order to keep districts as compact as possible, the best result came from simply filling from north to south or west to east (depending on the orientation of the geography). In this way, it always creates the most compact districts given the groups of blocks available. You can see how that works here, and the results of a splitting all the counties on the border of the filled regions:

### Open Source Resources

A big part of making something like this work and be trustworthy is transparency. So all code can be found here:

https://github.com/chrismlarson/redistricting

And the exported data can be found here:

https://github.com/chrismlarson/redistricting_data

If you have any questions or comments, feel free to reach out on Twitter: