As politics in the U.S. has polarized along geographic and racial lines, drawing political maps has become a partisan arms race. Even the smallest decisions about where to draw district boundaries can alter the power dynamic in Congress — without a single voter switching parties or moving.

It’s easy for opponents of gerrymandering — the drawing of political boundaries for the benefit of one party or group over another — to argue what districts shouldn’t look like. All they have to do is ridicule the absurdity of the most bizarre patchworks ever woven to elect members of Congress. For example, “The Rabbit on a Skateboard,” “The Upside-Down Chinese Dragon” or the “Mask of Zorro.”

But it’s much more difficult to say what districts should look like, because reformers can disagree on what priorities should govern our political cartography. Should districts be drawn to be more compact? More conducive to competitive elections? More inclusive of underrepresented racial groups? Should they yield a mix of Democratic and Republican representatives that better matches the political makeup of a state? Could they even be drawn at random? These concepts can be difficult to define and often stand in tension with one another.

To explore how subtle (and not-so-subtle) changes to district lines can affect the makeup of the U.S. House, we embarked on a project to redraw each state’s boundaries based on different priorities. We used a web-based application created by programmer Dave Bradlee and drew new maps six different ways:

To maximize the number of usually Democratic districts

To maximize the number of usually Republican districts

To make the partisan breakdown of states’ House seats proportional to the electorate

To promote highly competitive elections

To maximize the number of districts in which one minority group makes up the majority of the voting-age population in the district (what we’ll refer to as a majority-minority district)

To be compact while splitting as few counties as possible

Additionally, we explored an algorithmic approach to optimizing district compactness developed by programmer Brian Olson.

You can see the full interactive map here.

Here’s what happened when we drew each of those maps — and why each of these priorities matters in the real world:

Republican gerrymandering

When we gerrymandered the country to favor Republicans, this is what the congressional map looked like:

There has been an explosion of gerrymandering in popular discourse over the past few years — from the pages of Teen Vogue to the theme of 5K races. It has coincided with the rise of a perception among some on the left that Republicans have hijacked the redistricting process to take over America’s legislatures — at both the state and federal levels — and shield themselves from the popular will. (David Daley’s book “Ratf**ked: The True Story Behind the Secret Plan to Steal America’s Democracy” is a good example of that narrative.) But the truth is not that simple.

Republicans didn’t achieve historic shares of power in the House and state legislatures because they engaged in skullduggery or used fancy new technology, as Daley claims. They achieved it because they enjoyed a wave election in 2010, earning enough power in state houses to redraw almost five times as many congressional districts (210 to 44) as Democrats in 2011. As a result, Republicans’ share of House seats was 4 to 5 percentage points greater than their share of the major-party vote in 2012, 2014 and 2016.

However, as bad as that math sounds for Democrats, things could be a lot worse. Our interactive estimates that if Republicans controlled the process in every state and sought maximum advantage, they could draw up to 275 “usually Republican” seats and limit the other side to 139 “usually Democratic” seats, way up from the 195 to 168 advantage they enjoy under the current lines.

In practice, many states’ Republicans did seek maximum advantage in 2011 — often trampling districts’ compactness in the process. In North Carolina, for example, where Republicans drew 10 overwhelmingly Republican districts and three serpentine Democratic districts, not a single district had a Cook Partisan Voter Index score that was remotely competitive.

But Republicans didn’t always seek to build impenetrable fortresses. In many places, their goal was to spread their advantage more thinly over a large number of districts. The risk? Over time, such maps can unravel or backfire — particularly if the party has a bad year.

For example, in 2011, Pennsylvania’s Republicans drew five districts in the Philadelphia suburbs that all leaned to the GOP but not overwhelmingly so. In 2012, these districts were instrumental in helping Republicans win 13 of the state’s 18 U.S. House seats even though GOP candidates won 83,000 fewer votes than Democrats did. This week, Pennsylvania’s Supreme Court invalidated that map as an unconstitutional partisan gerrymander. But had the map remained in effect and a few of those seats fallen to Democrats in 2018, Republicans could have found themselves wishing that they had drawn a less ambitious, more secure map.

Democratic gerrymandering

Whether left-leaning reform activists admit it or not, Democrats haven’t gerrymandered any less aggressively than Republicans. They just had less than a quarter of the power to do so in 2011, hence the GOP’s current advantage. Need proof? Just try to decipher the Rorschach test-like maps that Democrats passed in states like Georgia in 2001 and Illinois and Maryland in 2011.

To draw those contorted maps, Democrats used the same advanced mapping software that Republicans have used elsewhere. But it’s also true that Democratic gerrymanders tend to be less effective than Republican gerrymanders, and not for lack of greed or ingenuity.

Our interactive estimates that if Democrats controlled the redistricting process in every state, they could draw 263 “usually Democratic” seats and limit the GOP to 145 “usually Republican” seats. But that’s less lopsided than the 275 to 139 advantage in “usually safe” seats that the Republicans would enjoy under their fantasy scenario. Why? The reasons are rooted in several fundamental geographic and legal realities.

First, more than in past decades, Democratic voters are inefficiently clustered in big cities and college towns. In 2012 and 2016, Barack Obama and Hillary Clinton carried the popular vote while winning just 22 percent and 16 percent of America’s counties, respectively. That means that in many states, it’s easier for Republicans to pack Democratic voters into a few lopsided districts than vice versa — a natural geographic advantage for the GOP.

Second, the Voting Rights Act limits the extent to which Democrats can spread their voters across many districts, because it provides safeguards against diluting majority-minority districts For example, if the Voting Rights Act didn’t exist, Illinois Democrats could theoretically “unpack” Chicago’s three heavily African-American districts and spread out their overwhelmingly Democratic voters to obliterate the state’s GOP-leaning districts. Instead, the current Democratic gerrymander in Illinois has produced a modest 11-7 Democratic edge in congressional seats.

These twin hardships can force Democrats to resort to more extreme mapping acrobatics to achieve desired outcomes. Our interactive’s Democratic map isn’t just less dominant than our GOP map; it scores lower on our compactness metric (which calculates the total length of the lines used to divide states into districts) and splits counties more frequently.

Ranking the maps How the maps compare on compactness, respect for local borders and district competitiveness Map Compactness rank County splits No. of highly Competitive Districts Compact (borders) 1 380 99 Compact (algorithmic) 2 1,660 104 Competitive 3 661 242 Proportionally partisan 4 659 82 GOP gerrymander 5 734 21 Majority minority 6 777 82 Dem. gerrymander 7 892 27 Current 8 621 72

But just like Republicans, Democrats haven’t always been hyper-aggressive in practice — sometimes, the desire to protect incumbents has outweighed the desire for more power. In 2001, California’s Democrats passed a plan designed to protect all of their 32 seats while preserving 20 Republican seats — using some pretty creative shapes in the process. They likely sold themselves short: In 2012, when an independent commission’s map took effect, Democrats gained four seats.

Compactness

Drawing districts that resemble normal shapes sounds easy enough. So why is it so hard? According to Loyola Law professor Justin Levitt’s research, 18 states have some requirement that districts be “compact.” But few states define compactness, and over the years, political scientists and mathematicians have proposed almost 100 different quantitative compactness measures, many of which conflict with one another.

Our interactive features two versions of “compact” maps, both drawn without regard to voters’ race or party. One simulates what a nonpartisan commission might draw by following existing borders like counties and cities as much as possible; the other uses a computer algorithm.

Both approaches increased the number of highly competitive districts over the current map by more than two dozen seats. The compactness map that is guided by borders scored especially highly on our compactness metrics: Compared with the current map, it reduced the total length of boundaries used to divide states into districts by 27 percent and reduced the number of times counties are split from 621 to 380.

But promoting compactness can sacrifice other goals. Because our compact maps ignored the Voting Rights Act in pursuit of geometric elegance, they feature fewer majority-minority districts than the current map does. After all, people who share the same traits — be they racial, cultural or economic — rarely live in neatly defined areas.

Breaking down the maps by race The number of districts by majority racial or ethnic group, according to 2010 census data Majority-Nonwhite Districts MAP ALL AFRICAN-AMERICAN HISPANIC/ LATINO ASIAN/ PACIFIC ISLANDER COALITION Majority minority 143 37 41 4 61 Proportionally partisan 93 22 31 0 40 Current 95 19 30 1 45 Dem. gerrymander 98 25 31 1 41 GOP gerrymander 90 23 32 0 35 Highly competitive 91 21 30 0 40 Compact (borders) 92 10 19 1 62 Compact (algorithmic) 89 8 24 1 56

Another casualty of “un-gerrymandering” can be a state’s political clout. In 2011, California’s independent commission replaced an incumbent-friendly map with one that emphasized keeping communities whole. In the ensuing 2012 election, 14 members retired or lost re-election, including once-powerful members like Republican Jerry Lewis, who delivered millions of dollars to the state from his perch atop the Appropriations Committee.

Proportionality

Gerrymandering allows majorities to seize even more power, leaving the other party underrepresented. But short of eliminating districts altogether and moving to a pure system of proportional representation, would it ever be possible to draw maps to reflect a state’s political sentiment proportionally? In trying to do so, we found that proportionality and our single-member system make awkward bedfellows.

Our interactive’s “proportionally partisan” map seeks to allocate a state’s seats to the parties in proportion to the political makeup of that state. For example, if a state has five districts and Republicans won an average of 60 percent of its major-party votes in the last two presidential elections, three districts would be drawn with a Republican lean and two would be drawn with a Democratic lean. In the process, it aimed to minimize the efficiency gap, a metric established by political scientists to detect the potential extent of partisan gerrymandering by measuring how many votes each party “wastes” in wins and losses. The metric is currently being considered by the Supreme Court as a way to evaluate partisan gerrymandering.

But in some states, natural political geography virtually rules out proportionality. For example, Democrats’ share of statewide votes would entitle them to one of West Virginia’s three seats in this scenario. However, there just aren’t enough Democratic-leaning precincts in West Virginia to form a Democratic-leaning district.

And in other states, the most “proportional” map was actually a partisan gerrymander: For example, achieving proportionality in California required a pro-GOP gerrymander. In Pennsylvania, it required a pro-Democratic gerrymander. This finding highlights one of the efficiency gap’s drawbacks: It could have a tough time distinguishing between true gerrymanders and natural geographic advantages.

Competitiveness

In an era when Democrats and Republicans are choosing to live next to like-minded neighbors, drawing lots of competitive districts can be tricky. In fact, in some cases, it requires conscious, pro-competitive gerrymandering. So we decided to look at what a map would look like if we gerrymandered districts so they were as competitive as possible.

Only two states have redistricting criteria that actively encourage the creation of districts that are competitive in general elections: Arizona and Washington, which both employ bipartisan redistricting commissions.

Arizona’s attempts to abide by that mandate got ugly. Its 2011 redistricting led to three closely divided districts out of nine total, including one that was won by Donald Trump and is now represented by a Democrat and another that Hillary Clinton won and is now held by the GOP. But constructing those three districts while preserving two Latino-majority districts to comply with the Voting Rights Act required some map-making gymnastics and ignited a redistricting firestorm in which the state’s leading Republicans accused the commission’s independent chair of being a Democratic lackey.

Podcast: Competitive Elections In Arizona

Our interactive’s “highly competitive” map features 242 districts where both parties have at least a roughly 1-in-6 chance of winning, a more than three-fold increase over the 72 in the current map.

The result would be a House hypersensitive to the nation’s political mood swings — and members who would have more electoral incentive to cater to voters outside their parties’ bases. But the map wouldn’t be especially compact; it would split counties more times than the current map does. And according to our model, it would elect fewer nonwhite members of Congress than the current map.

Minority representation

Today, in a nation where 39 percent of the population belongs to a racial or ethnic minority group, people who aren’t white make up just 22 percent of the House. For decades, courts have struggled to define the proper role of race in redistricting — and it may always be a moving target.

In the 1991 round of redistricting, the Bush Justice Department – armed with the power to deny maps preclearance under the Voting Rights Act – virtually forced states to maximize the number of majority-minority districts, even if they looked like inkblots. The Supreme Court later reined in the most grotesquely shaped districts. But the 1992 election launched the careers of several prominent minority politicians still serving today, including Reps. Luis Gutierrez of Illinois and Jim Clyburn of South Carolina.

Our interactive’s “majority minority” map simulates what maps might look like if that doctrine were in effect today. We found that by resorting to some extreme shapes, the number of majority nonwhite districts could be increased from 95 to 143, including 18 new African-American majority districts, 11 new Latino majority districts and three new Asian-American majority districts.

But are districts with an absolute majority of a specific minority group (51 percent Latino, for example) the best vehicles for representing minority voters? Maybe not.

First, it’s not clear such districts are as essential to electing minority candidates to Congress as they used to be. In 2016, 50 of the 96 minority members elected to the House came from districts with either a white majority or no racial majority. In other words, minority candidates are increasingly demonstrating that they can win in districts that aren’t dominated by one minority group.

Second, many scholars now wonder whether majority-minority districts have done more favors for Republicans than minorities because they’ve made surrounding districts whiter and more Republican. In the past few years, plaintiffs represented by Democratic attorneys have successfully sued to “unpack” majority-minority districts in North Carolina and Virginia on the basis that they were drawn with racially discriminatory intent by GOP legislators.

Third, 25 years after their proliferation, majority-minority districts have proved to be career cul-de-sacs for their occupants. By my count, over the past three decades, 70 House members of all races and ethnicities have won statewide office directly from their House seats. But only eight minority politicians representing majority-minority districts have attempted to run for statewide office — and zero won. During the same period, 28 other minority politicians have won election statewide, but none of them came from a majority-minority district.

Algorithmic districts?

All of these complexities make it seem like randomizing the redistricting process might be a better approach. What if gerrymandering is a problem better solved by mathematicians and computer scientists than politicians and political scientists? What if we could move to a system that didn’t consider race or partisanship at all — one that had no pre-assigned winners and losers, costly litigation or drag-out fights in state capitals?

The dream of automated redistricting has been around as least as far back as 1963, when the influential paper “A Procedure for Nonpartisan Districting: Development of Computer Techniques” by James Weaver and Sidney Hess was published.

Our interactive’s algorithmically drawn map features the work of software engineer Brian Olson, whose algorithm uses census blocks to minimize the average distance between constituents and the center of their districts. The drawback? It disregards existing jurisdictional boundaries like counties, which would make real-world election administration a nightmare.

But soon it may be within our technological reach to resolve those practical concerns. If I had a magic wand, I’d develop an algorithm that: a) draws the shortest possible line(s) necessary to split a state into equally populous districts and b) requires that only as many pre-existing jurisdictions be split as necessary to achieve equally populous districts. The result might look something like our earlier map that used county borders to promote compactness.

The bottom line? Gerrymandering is a really easy practice to condemn and a really complex problem to solve. And just as there are no permanent majorities in American politics, there may never be such a thing as a perfect map.