I’m thinking it’s simple geometry - every district has to be as close to a square as possible, and make the squares large enough or small enough to encompass the same number of people in each Congressional District.
A set of circles would generate the smallest "edge length". But, it would leave a a lot of space between them. :-)
For adjacent figures (or districts), squares would yield the smallest overall edge length. But, you'd still have the problem with political boundaries -- which is why I proposed the exceptions.
There is a way to specify this algorithmically: a good mathematician would be able to do it, and apply it to the 2010 census data (voting age population only -- no other factors should be allowed).
THEN, someone could test it against recent vote tabulations to predict the probable outcomes and identify the contested districts. It would be really interesting to compare it to the results of the inevitable gerrymandering.
This would be an great research project. I wonder if anyone would be willing to undertake it and publish the results?
Squares and circles are hard because districts have uneven population densities. And you still have to decide where to seed the squares or circiles. But fortunately, computer programs can be sophisticated enough to implement an agreed-apon set of values. I’d suggest tasking the computer to find districts which divide the fewest number of local-government jurisdictions. The jursidictions could be weighted for population, so splitting wards in Manhattan would be as bad as splitting counties in the Adirondack; that way gerrymandering couldn’t take place within massive jurisdictions.