Gerrymandering and Computational Redistricting

by   Olivia Guest, et al.

Partisan gerrymandering poses a threat to democracy. Moreover, the complexity of the districting task may exceed human capacities. One potential solution is using computational models to automate the districting process by optimising objective and open criteria, such as how spatially compact districts are. We formulated one such model that minimised pairwise distance between voters within a district. Using US Census Bureau data, we confirmed our prediction that the difference in compactness between the computed and actual districts would be greatest for states that are large and therefore difficult for humans to properly district given their limited capacities. The computed solutions highlighted differences in how humans and machines solve this task with machine solutions more fully optimised and displaying emergent properties not evident in human solutions. These results suggest a division of labour in which humans debate and formulate districting criteria whereas machines optimise the criteria to draw the district boundaries.


Human vs. supervised machine learning: Who learns patterns faster?

The capabilities of supervised machine learning (SML), especially compar...

Can We Distinguish Machine Learning from Human Learning?

What makes a task relatively more or less difficult for a machine compar...

Speaker discrimination in humans and machines: Effects of speaking style variability

Does speaking style variation affect humans' ability to distinguish indi...

The Notorious Difficulty of Comparing Human and Machine Perception

With the rise of machines to human-level performance in complex recognit...

On the independence between phenomenal consciousness and computational intelligence

Consciousness and intelligence are properties commonly understood as dep...

Human-Machine Inference Networks For Smart Decision Making: Opportunities and Challenges

The emerging paradigm of Human-Machine Inference Networks (HuMaINs) comb...

On the notion of number in humans and machines

In this paper, we performed two types of software experiments to study t...

1 Results

Our clustering algorithm created improved maps for every state, see Figure 2. Visit to compare the actual and automated districting plans for any address in the USA. We define the improvement for each state as the ratio of pairwise distances within districts between our solution and the actual districts. This metric favours districts in which voters are tightly clustered spatially, leading to a mean improvement across states of

(i.e,. about 20%) with standard deviation

. To test our main prediction, a regression model was fit to the state improvement scores with number of districts, and square of number of districts serving as predictors, , . Both predictors in the fit, , were statistically significant, and , respectively. Consistent with our prediction, these results suggest that the cognitive demands of drawing districts for larger states may tax human capacities. Thus, some of the unfairness in current solutions may be unintentional, as opposed to wholly attributable to deliberate gerrymandering for political gain.

The regression also included a quadratic term for the number of districts that confirmed the intuition that the complexity of the task should not scale linearly with the number of districts because the clustering is spatial and local interactions dominate. For instance, there are natural groupings and locality within big states, e.g., what is drawn for Los Angeles is unlikely to strongly affect what is drawn in San Francisco. People likely segment maps hierarchically into regional groupings to reduce processing demands, as they do in other map reasoning tasks (Graham ., 2000), which may explain fallacious conclusions like that Reno lies east of Los Angeles and that Atlanta is east of Detroit (Myers, 2002). Overall, the district size results indicate that states with fewer districts are easier to draw properly, which suggests that state size may be another cause of “accidental gerrymandering” (Chen  Rodden, 2013). The residuals from this regression model can be interpreted as how gerrymandered each state is, adjusting for population. This analysis suggests that Arizona is the most gerrymandered state (see Table 1 for the complete ranking).

Let us turn to some specific examples for redistricting solutions (for an interactive map, visit For Iowa, which uses a neutral commission to draw district boundaries (Levitt, 2011), our automated solution uses fewer segments (Figure 3b) than the more complex actual solution (Figure 3a). In the case of North Carolina, where maps are drawn through a partisan process, improvements are also evident (Figure 3c, d).

Figure 3: Actual and computed district maps for Iowa (a, b) and North Carolina (c, d). Computed solutions are shown in green to the right of the actual congressional districts. Darker areas on the map (census tracts) are more densely populated.

Notwithstanding Utah’s “long tradition of requiring that districts be […] reasonably compact” (Christensen  Taylor, 2001), the densely populated northern conurbation of Provo, Salt Lake City, and West Valley City, is cracked, diluting the urban vote by recruiting parts of the countryside, reaching to the southern border of the state (Figure 4a). In the computed solution, the urban area of West Valley and Salt Lake City is assigned to a single urban district, as is Provo and its surrounding conurbation (Figure 4b).

The automated districting of Arizona showcases an emergent property of our algorithm that human-drawn maps have not displayed, namely that districts can be embedded within one another, such as a small densely populated urban district encircled by a large sparsely populated rural district (i.e., shaped like a doughnut). Rather than crack Tuscon across 3 districts (Figure 4c), the algorithm settled on a doughnut structure (Figure 4d).

An interesting case of convergence between human and algorithm is the case of Nebraska (Figure 4e). Our algorithm followed in the footsteps of those who districted Nebraska (Figure 4f), capturing the same transition from fully urban (east) to fully rural (west). However, the smooth radiating boundaries surrounding the capital, Omaha, are more compact (optimised) in the automated solution.

2 Discussion

In summary, we applied our novel weighted k-means algorithm to US Census Bureau data to redistrict the USA’s 435 congressional districts and compared the computed solutions to actual districts. The results confirmed our prediction that larger states would tend to show greater improvement, suggesting that the complexity of the districting task may overwhelm humans’ ability to find optimal solutions. One startling conclusion is that some of what we view as purposeful gerrymandering may reflect human cognitive limitations.

In light of these results, we advocate a division of labour between human and machine. Stakeholders should openly debate and justify the districting criteria. Once the criteria are determined by humans, it should be left to the computers to draw the lines given humans’ cognitive limitations and potential partisan bias. We offer one of many potential solutions. The computer code, like ours used in these simulations, should be open-source (to allow for replication and scrutiny) and straightforward to provide confidence in its operation.

Political, ethical, scholarly, and legal debate should play a central role in determining the optimisation criteria. For example, instead of choosing the mean pairwise distance between constituents, we could have used travel time to capture the effects of geographical barriers, such as rivers. Even a measure as simple as travel time raises a number of ideological considerations that should be debated, such as the mode of transportation (e.g., public, on foot, or by automobile) to adopt. Other factors could be included in the criteria, such as respecting municipal boundaries, historic communities, the racial composition of districts, partisan affiliation, etc. For our demonstration, we chose perhaps the simplest reasonable criteria, but in application the choice of criteria would ideally involve other factors after lengthy debate involving a number of stakeholders. These debates should elevate democratic discourse by focusing minds on principles and values, as opposed to how to draw maps for partisan advantage.

Figure 4: Actual and computed district maps for Utah (a, b), Arizona (c, d), and Nebraska (e, f). Computed solutions are shown in green to the right of the actual congressional districts. Darker areas on the map (census tracts) are more densely populated.

We believe this automated, yet inclusive and open, approach to redistricting is preferable to the current system for which the populace’s only remedy is the court system, which has proven ineffective in this arena. The law and case history for gerrymandering is complex and we will not feign to provide an adequate review here. However, two key points are a) courts are reactive and proceed slowly relative to the pace of election cycles (i.e., before any action would be taken, disenfranchisement would have already occurred); and b) the Supreme Court of the United States has never struck down a politically gerrymandered district (Liptak, 2017). After centuries of gerrymandering complaints, for the first time the Supreme Court has agreed to hear a case concerning whether Wisconsin’s partisan gerrymandering is in breach of the First Amendment and the Voting Rights Act (Liptak, 2017).

In such legal cases, the concept of voting efficiency has prominently featured (Stephanopoulos  McGhee, 2015). The basic concept is that votes for the losing party in a district are “wasted" (related to cracking) as well as votes for the winning party over what is needed to secure victory (related to packing). Formal measures of efficiency can be readily calculated and compared (Stephanopoulos  McGhee, 2015). Although these measures have their place in illustrating disparities, we find it preferable to focus on optimising core principles and values, rather than rarify the status quo and reduce voters to partisan apparatchiks whose preferences and turnout tendencies are treated as fixed across election cycles, which they are not.

In contrast to voter efficiency approaches, an algorithm like ours will naturally lead to cases where groups “self-gerrymander”, such as when like-minded communities form in densely populated areas (McCarty ., 2009; Chen  Rodden, 2013). However, it is debatable whether these votes are truly wasted. Representatives for these relatively homogeneous communities may have a stronger voice and feel emboldened to advocate for issues that are important to their community, even when these positions may not be popular on the national stage. After all, almost by definition, every important social movement, such as the Civil Rights movement or campaigns for LGBT equality, are not popular at inception. Nevertheless, concepts like voter efficiency could be included in the optimisation criteria for algorithms like ours. When faced with complex issues as to what is fair, the best solution may be the division of labour what we advocate: humans formalise objective criteria through open discourse and the computers search for an optimal solution unburdened by human limitations.


This section details how the US Census Bureau data were preprocessed, and provides details on the weighted k-means model.

2.1 Census Data

US Census Bureau data were used to perform the district clusterings reported in the main text. For clustering, we used the smallest available geographic unit, known as a census block. The US Census Bureau collects data for just over 11 million census blocks of which almost 5 million have a population of 0. The last decennial census occurred in 2010. However, as recently as 2015, the US Census Bureau conducted the ACS (American Community Survey), which is a survey at one level above the block level, which is referred to as a block group. Using these 2015 counts, we estimated the population of each census block in 2015 by calculating its population share of its block group in 2010 and, assuming these proportions had not changed, updated the block populations based on the 2015 ACS. Notice that our population estimates for census blocks in 2015 is not constrained to be an integer.

Census blocks in urban areas tend to be geographically smaller but more populated. Based on our estimates combining the 2010 and 2015 data, the mean population of a census block is with a median of people. The mean area of a census block km with a median of km.

2.2 Initialisation

The manner in which clusters are initialised will affect the quality of the final solution because our algorithm, like k-means which it generalises, moves toward a local optimum. We initialise the centroids using the procedure from k-means++ (Arthur  Vassilvitskii, 2007).

2.3 Weighted k-means Algorithm

Weighted k-means generalises k-means by preferring clusters of roughly the same cardinality (i.e., number of members) with the strength of this preference determined by a parameter value. Like k-means, in each iteration, items are assigned to the nearest cluster and at the end of iteration the position of the cluster (i.e., centroid) is updated to reflect its members’ positions. After a number of iterations, the algorithm converges to a local optimum. Weighted k-means differs from k-means by penalising clusters with more members such that distances to these clusters are multiplied by a scaling factor reflecting the cluster’s cardinality. The weight for cluster is


where is the cardinality of cluster , is the number of clusters, and is a parameter that determines how much to penalise clusters with a disproportionate number of members.

To stabilise solutions across iterations and prevent oscillations, the scaling factor for cluster at time (i.e., iteration ) is calculated as a weighted combination of the previous scaling factor and


where is a control parameter in the range . In the first iteration, each is initialised to where is the number of clusters.

The scaled distance of point to the cluster is


where is the position of cluster and is the distance metric, which in this contribution is great-circle distance (also known as orthodromic or geodesic distance, estimated using the haversine formula), which respects the curvature of the Earth.

Finally, is used to find the nearest weighted cluster from point , to which will be assigned. Notice that this algorithm is identical to k-means when is . As increases, the constraint of equal cardinality becomes firmer.

State Residuals State Residuals State Residuals
AZ -0.1482 ME -0.0329 NE 0.0267
MD -0.0820 NM -0.0220 OR 0.0399
LA -0.0792 NH -0.0158 SC 0.0401
OH -0.0747 WA -0.0122 WI 0.0419
VA -0.0747 NJ -0.0043 CT 0.0426
UT -0.0632 CA -0.0036 MA 0.0437
TX -0.0623 IA -0.0022 MS 0.0458
NC -0.0551 AL 0.0027 OK 0.0527
IL -0.0538 HI 0.0137 MN 0.0563
TN -0.0503 GA 0.0181 FL 0.0568
PA -0.0475 KY 0.0203 KS 0.0603
WV -0.0466 ID 0.0217 NV 0.0628
RI -0.0458 MO 0.0239 IN 0.0813
CO -0.0386 AR 0.0244 MI 0.1047
NY 0.1345
Table 1: States sorted by their residuals from the regression model described in the main text. A state’s residual can be interpreted as how gerrymandered the state is after taking into account the number of districts, with negative residuals indicating greater gerrymandering. Of course, there could be other important covariates in addition to population size.

2.4 Parameter Fitting

Solutions are only considered that converge and for which the cardinalities of the clusters are in line with that of actual congressional districts. In principle, one could use any parameter search procedure to find and that minimised the measure we report, which is the pairwise distance of voters within a district (i.e., cluster). For example, one could use grid search to consider all possible combinations (at some granularity) of and .

However, given available computing resources, we adopted a more efficient procedure informed by our understanding of the algorithm’s behaviour (i.e., smaller values lead to tighter clusterings). The parameter search procedure began with set to 0 and increased until an acceptable solution was found. At each level of , was set to and increased by after a simulation failure until exceeded its range. At that point, was increased by and the process was repeated with set to . This procedure terminated when an acceptable solution was found. At that point, a finer-grained optimisation was performed, which considered values up to lower than first acceptable value found.


  • Altman . (2015) altman2015Altman, M., Amos, B., McDonald, MP.  Smith, DA.  2015. Revealing Preferences: Why Gerrymanders are Hard to Prove, and What to Do about It Revealing Preferences: Why Gerrymanders are Hard to Prove, and What to Do about It. SSRN. 10.2139/ssrn.2583528
  • Altman . (2014) altman2014aAltman, M., Magar, E., McDonald, MP.  Trelles, A.  2014. The Effects of Automated Redistricting and Partisan Strategic Interaction on Representation: The Case of Mexico The Effects of Automated Redistricting and Partisan Strategic Interaction on Representation: The Case of Mexico. Annual Meeting of the American Political Science Association. Annual meeting of the american political science association. 10.2139/ssrn.2486885
  • Arnold (2017) arnold2017Arnold, C.  2017. The MATHEMATICIANS WHO WANT TO SAVE DEMOCRACY The mathematicians who want to save democracy. Nature5468.
  • Arthur  Vassilvitskii (2007) arthur2007Arthur, D.  Vassilvitskii, S.  2007. k-means++: The advantages of careful seeding k-means++: The advantages of careful seeding. Proceedings of the eighteenth annual ACM-SIAM symposium on Discrete algorithms Proceedings of the eighteenth annual ACM-SIAM symposium on Discrete algorithms ( 1027–1035).
  • Bazelon (2017) bazelon2017Bazelon, E.  2017. The New Front in the Gerrymandering Wars: Democracy vs. Math The New Front in the Gerrymandering Wars: Democracy vs. Math. The New York Times.
  • Browdy (1990) browdy1990Browdy, MH.  1990. Computer Models and Post-Bandemer Redistricting Computer models and post-bandemer redistricting. The Yale Law Journal9961379–1398.
  • Chen  Rodden (2013) chen2013Chen, J.  Rodden, J.  2013. Unintentional gerrymandering: Political geography and electoral bias in legislatures Unintentional gerrymandering: Political geography and electoral bias in legislatures. Quarterly Journal of Political Science83239–269.
  • Christensen  Taylor (2001) christensen2001Christensen, ME.  Taylor, MG.  2001. Redistricting Committee Report. Redistricting committee report.
  • Dealey (1908) dealey1908Dealey, JQ.  1908. The Rise and Growth of the Gerrymander The rise and growth of the gerrymander. American Political Science Review23480–480. 10.2307/1944832
  • García . (2015) garcia2015García, EAR., Andrade, MÁG., de-los Cobos-Silva, SG., Ponsich, A., Mora-Gutiérrez, RA.  Lara-Velázquez, P.  2015. A System for Political Districting in the State of Mexico A system for political districting in the state of mexico.

    Advances in Artificial Intelligence and Soft Computing: 14th Mexican International Conference on Artificial Intelligence, MICAI 2015, Cuernavaca, Morelos, Mexico, October 25-31, 2015, Proceedings, Part I Advances in artificial intelligence and soft computing: 14th mexican international conference on artificial intelligence, micai 2015, cuernavaca, morelos, mexico, october 25-31, 2015, proceedings, part i ( 248–259).

    ChamSpringer International Publishing.
  • Graham . (2000) graham2000Graham, SM., Joshi, A.  Pizlo, Z.  2000Oct01. The traveling salesman problem: A hierarchical model The traveling salesman problem: A hierarchical model. Memory & Cognition2871191–1204. 10.3758/BF03211820
  • Hess . (1965) hess1965Hess, SW., Weaver, JB., Siegfeldt, HJ., Whelan, JN.  Zitlau, PA.  1965. Nonpartisan Political Redistricting by Computer Nonpartisan political redistricting by computer. Operations Research136998–1006. 10.1287/opre.13.6.998
  • Issacharoff (2002) issacharoff2002Issacharoff, S.  2002. Gerrymandering and Political Cartels Gerrymandering and political cartels. Harvard Law Review1162593-648.
  • Levitt (2011) levitt2011Levitt, J.  2011. The Legal Context for Scientific Redistricting Analysis The legal context for scientific redistricting analysis. SSRN.
  • Liptak (2017) liptak2017Liptak, A.  2017. Justices to Hear Major Challenge to Partisan Gerrymandering Justices to hear major challenge to partisan gerrymandering. The New York Times.
  • Lloyd (1982) lloyd1982Lloyd, S.  1982. Least squares quantization in PCM Least squares quantization in pcm. IEEE transactions on information theory282129–137.
  • McCarty . (2009) mccarty2009McCarty, N., Poole, KT.  Rosenthal, H.  2009. Does gerrymandering cause polarization? Does gerrymandering cause polarization? American Journal of Political Science533666–680.
  • Myers (2002) myers2002Myers, DG.  2002. Intuition: Its Powers and Perils Intuition: Its powers and perils. Yale University Press.
  • Palmer (1990) Palmer1990Palmer, SE.  1990. Modern Theories of Gestalt Perception Modern theories of gestalt perception. Mind and Language54289–323.
  • Parker (1984) parker1984Parker, FR.  1984. Minority Vote Dilution Minority vote dilution. ( 85–115). Howard University Press.
  • Ponsich . (2017) ponsich2017Ponsich, A., García, EAR., Gutiérrez, RAM., Silva, SGdlC., Andrade, MAG.  Velázquez, PL.  2017. Solving Electoral Zone Design Problems with NSGA-II: Application to Redistricting in Mexico Solving electoral zone design problems with nsga-ii: Application to redistricting in mexico. Proceedings of the Genetic and Evolutionary Computation Conference Companion Proceedings of the genetic and evolutionary computation conference companion ( 159–160). New York, NY, USAACM. 10.1145/3067695.3076103
  • Stephanopoulos  McGhee (2015) stephanopoulos2015Stephanopoulos, NO.  McGhee, EM.  2015. Partisan gerrymandering and the efficiency gap Partisan gerrymandering and the efficiency gap. The University of Chicago Law Review831–900.
  • Taylor (2016) taylor2016Taylor, D.  2016. Gerrymandering, explained Gerrymandering, explained. The Washington Post.
  • Vickrey (1961) vickrey1961Vickrey, W.  1961. On the Prevention of Gerrymandering On the prevention of gerrymandering. Political Science Quarterly.