Dynamic Trade Communities and Global Fragmentation
Overview
This project implements a reproducible annual-network pipeline for studying trade fragmentation. It separates the network used for community detection from the original directed flows used for economic accounting and creates stable lineage labels across years.
Research Question
Has global trade become more concentrated within dense communities, and which countries change their closest community affiliation as the network evolves?
Economic or Technical Motivation
Raw community labels are arbitrary across years. Longitudinal analysis requires a reproducible way to match communities, distinguish internal from cross-community trade, and test whether a result depends on the Leiden resolution parameter.
Data
The executed results cover annual BACI HS96 trade networks from 1996 to 2024. Product-level records are validated and aggregated to exporter-importer-year flows, then converted into weighted bilateral networks while retaining directed flows for trade-share accounting.
Methodology
For each year, the code creates a weighted bilateral graph, applies Leiden community detection using the RB configuration partition, computes modularity and within/cross-community trade shares, and matches adjacent-year communities by Jaccard overlap. Resolution robustness and country-switch diagnostics are exported.
Main Findings
Weighted modularity rises from 0.272 in 1996 to 0.416 in 2024. Within-community trade increases from 66.5% to 70.5%, and the number of detected communities rises from four to six. The pipeline identifies 219 countries that change lineage at least once.
Robustness, Validation, or Model Assessment
The package includes tests for BACI ingestion and the network pipeline, fixed random seeds, lineage thresholds, alternative resolution outputs, data validation, and publication-oriented tables. The interpretation report explicitly states that stronger communities are consistent with fragmentation but do not prove a geopolitical cause.
Tools and Technologies
Python, pandas, NumPy, igraph, leidenalg, matplotlib, seaborn, pytest, and BACI data processing are directly demonstrated.
Limitations
Community detection is descriptive and sensitive to graph definition, resolution, price valuation, commodity composition, and reporting coverage. Country switches require institutional interpretation and are not events with a single identified cause.
Deliverables
- Installable Python package and command-line tools
- BACI merge and product-filter pipeline
- Seven publication-oriented tables and five figures
- Resolution robustness and country-lineage outputs
- Automated tests and economic interpretation report