The Known Sizes of Grid Metagraphs

At MGGG, we think that one of the reasons that redistricting is hard to study is that the space of possibilities (i.e., valid districting plans) is so huge it's unthinkable by humans. And relatedly, the number of ways to achieve any simple objective is overwhelmingly large.

We think that to study districting plans in context, you need to understand the space of alternatives. So we are working on the science of sampling from these universes of districting plans. As a simplified warmup problem, we can ask how many ways there would be to district a jurisdiction made up of a small number of units with equal population arranged in a perfect grid. We can then build up the complexity from there. But this problem is already formidable!

In this table, the row marked nxn → d shows the number of ways to partition an n by n grid into d districts (or connected pieces). The columns describe how much size difference is tolerated among the districts. The two halves of the table distinguish whether, to be considered contiguous, the districts would have to be transitable by a chess rook (making only NSEW moves) or a chess queen (which can also move diagonally). Queen contiguity allows many more district shapes.

Rook Queen
equal size ± 1 ± 2 ± 3 all, non-∅ equal size ± 1 ± 2 ± 3 all, non-∅
2x2 → 22666637777
3x3 → 3105817022625836224622746782
4x4 → 2702063384546271,7184,6906,6307,5988,171
4x4 → 41171,9538,84929,06962,7412,62046,456222,398710,6221,130,612
4x4 → 83634,444153,094251,230340,198280567,7252,629,0814,262,9175,362,109
5x5 → 54,006193,128147,2506,194,822?1,397,79070,491,206???
6x6 → 280,518241,218400,474557,0311,123,743?????
6x6 → 3264,5001,848,872????????
6x6 → 4442,7918,313,719????????
6x6 → 6451,20661,412,106????????
6x6 → 9178,939600,896,399????????
6x6 → 1280,092?????????
6x6 → 186,728????3,037,561????
7x7 → 7158,753,814?????????
8x8 → 8187,497,290,034?????????
9x9 → 9706,152,947,468,301?????????

The generation of the numbers in this table was overseen by MGGG's Zach Schutzman and Daryl DeFord. We used a combination of our own python code and an algorithm coded by Bob Harris (code, writeup; OEIS) in C in 2010. We've checked the math behind both algorithms and are confident in both implementations.

As of October 2018, we've got runs going on MIT's OpenStack to extend the coverage of this table. Each missing value is expected to take at least a day, and sometimes weeks or more, of computer time.

An earlier version of the table, which appears in November's print version of Scientific American, used partition enumeration code that was included with the R package redist— that code turns out to be buggy. As a result, some of the numbers have since been corrected.