Redistricting for Python
Mosaic is a redistricting toolkit using recombination (ReCom) algorithms with simulated annealing. It includes a live GUI for map visualization and optimization.
Option 1: Run the launcher (no Python required)
- Download the project: Click the green Code button at the top of this page, then select Download ZIP
- Extract the ZIP: Right-click the downloaded file and choose "Extract All"
- Run the launcher:
- Windows: Double-click
run_mosaic.bat - Mac/Linux: Open a terminal in the folder and run
chmod +x run_mosaic.sh && ./run_mosaic.sh
- Windows: Double-click
The launcher auto-installs dependencies on first run (requires internet).
Option 2: Install with pip
pip install -e .
mosaic- Python >= 3.10
- Windows 10+ / macOS 12+ / Linux
The shapefiles/ folder includes North Carolina precinct data as a ready-to-use starting point.
This is a Python port of Mosaic for R. Some features are implemented differently or still in progress.
MIT License - see LICENSE
A project of Matt Mohn (@mattmxhn). The ReCom algorithm is derived from the one developed by the MGGG Redistricting Lab.
