Settlement-scale graph-based spatial aggregation for Zambia electrification planning
# zambia-vgae-tranching
Code and analysis-ready data for a settlement-scale, graph-based spatial
aggregation study of electrification planning in Zambia. The repository
supports the paper's connected-planning-unit contribution: a topology-aware
aggregation layer that converts point-level electrification outputs into
connected, technology-characterised planning units and interpretable
supply-curve bands.
## Scientific purpose
Using 24,550 Zambia settlements (World Bank Distributed Renewable Energy
Atlas settlement locations, matched to World Bank Global Electrification
Platform V2 2030 scenario outputs), this repository compares three
tranching methods for grouping settlements into electrification-planning
bands:
- **k-means** on standardised features (feature-space baseline),
- **cost-bin** tranching on ordered levelised cost of electricity (LCOE),
- **VGAE** (Variational Graph Auto-Encoder) tranching, using a learned
embedding of a settlement proximity graph, clustered at K=8.
The comparative evaluation measures spatial contiguity and supply-curve
smoothness across the three methods. The repository's core contribution is
the connected-planning-unit layer: each VGAE tranche is decomposed into
connected components under a stored settlement proximity graph, producing
local, spatially connected planning units with review-candidate flags and
per-unit supply curves, in addition to the national-scale tranche bands.
## Quick start
```bash
python -m venv .venv
```
Windows:
```bash
.venv\Scripts\activate
```
macOS/Linux:
```bash
source .venv/bin/activate
```
```bash
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python scripts/verify_checksums.py
python scripts/reproduce_paper_results.py
python scripts/validate_release.py
```
`requirements-dev.txt` additionally installs `pytest` for the test suite
(`python -m pytest -q`). `requirements-training.txt` lists the optional,
heavier dependencies (PyTorch, PyTorch Geometric) needed only t …