This repo contains sample electoral data, including adjacency graphs, units at various scales, demographic data, and past election results. We’ve started with data from Minnesota’s Legislative Coordinating Commission covering an area to the north and west of Minneapolis with a mix of urban, rural, white, non-white, conservative, and liberal voters.
See an interactive map of demographics and voting patterns (source code in map.html).
Also see an interactive map of several generated plans (source code in maps.html).
Four layers are included: minor civil divisions (MCDs), Census tracts, voter tabulation districts (VTDs), and Census blocks. Raw data and adjacency lists for graph representations are included for each. Each includes demographic and race data detailed in metadata.
- Size: 24 units, 46 edges
- ID field:
MCD
- Adjacency list: mcd2010-graph.csv
- Shapefile: mcd2010-slice.zip
- CSV: mcd2010-slice.csv
- Size: 94 units, 228 edges
- ID field:
TRACT
- Adjacency list: tracts2010-graph.csv
- Shapefile: tracts2010-slice.zip
- CSV: tracts2010-slice.csv
- Size: 133 units, 334 edges
- ID field:
VTD
- Adjacency list: vtd2010-graph.csv
- Shapefile: vtd2010-slice.zip
- CSV: vtd2010-slice.csv
- Size: 5,358 units, 12,802 edges
- ID field:
BLOCK
- Adjacency list: blk2010-graph.csv
- Shapefile: blk2010-slice.zip
- CSV: blk2010-slice.csv.gz
We used the python-igraph in order to prototype enumerating possible partitioning schemes. See the generate_partitions.py file for doing this enumeration:
$ python generate_partitions.py mcd2010-slice.csv mcd2010-graph.csv
Number of partitions: 5
[1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
[1, 2, 2, 2, 2, 2, 2, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
[1, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
[1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2]
[1, 2, 2, 1, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
Each of these lines corresponds to a partitioning of the MCD's in the input files, which can then be visualized by editing maps.html.