This tool groups sub-national regions into "clusters" using the strength of Facebook friendship ties between them. Two regions are treated as close when a randomly chosen Facebook user in one is highly likely to be friends with a randomly chosen user in the other.
Under the hood it uses hierarchical clustering: every region starts on its own, and the communities whose residents are most connected are merged step by step until the number of clusters you chose remains. Merges are weighted by population, so communities reflect where people actually are rather than how finely a country happens to be subdivided. No geographic constraint is applied — clusters are usually contiguous, but a strong long-distance tie can place non-adjacent regions together.
More details, including the full data download, are available at the Humanitarian Data Exchange.
Interactive map powered by MapLibre. Default basemap by OpenFreeMap, OpenMapTiles, and OpenStreetMap contributors.
This tool finds communities — groups of regions whose residents are unusually likely to be Facebook friends with one another. Everything runs in your browser. Here is the full method, from raw data to the coloured map.
For every pair of regions we use the public Social Connectedness Index (SCI): a measure proportional to the probability that a randomly chosen Facebook user in one region and a randomly chosen user in the other are friends. Because it is already divided by each region's user count, the SCI is a per-person measure — it is not inflated simply by a region being large.
We turn connectedness into a distance: regions with a high SCI are
“close”, regions with a low SCI are “far”. The distance is −log(SCI).
The log matters because the SCI spans many orders of magnitude; without it a handful
of very strong ties would dominate everything.
We use hierarchical agglomerative clustering. Every region starts as its own community; we then repeatedly merge the two closest communities, recording the order of every merge, until only one remains.
The crucial choice is how to measure the distance between two communities that each contain many regions. We define it as the average distance between a random resident of one community and a random resident of the other. Each region's contribution is weighted by its population, so the distance between communities I and J is the population-weighted average of the region-to-region distances (each pair weighted by the product of the two regions' populations). This is known as population-weighted average linkage.
Weighting by population matters because administrative regions vary wildly in size. Without it, a country carved into hundreds of tiny districts would out-vote one split into a few large provinces. With it, a community's “pull” reflects its people: larger populations carry more weight, while small administrative units do not get extra influence just because there are many of them.
Because every merge was recorded, the full hierarchy forms a tree. Asking for K communities just means cutting that tree so K branches remain.
Cutting the tree gives exactly K communities. After that, the map does one small visual cleanup: if a cluster has a tiny non-contiguous piece of three regions or fewer, that piece is assigned to the neighbouring cluster it borders most. This removes isolated specks without imposing a general geographic constraint or folding low-population communities away. If this cleanup changes the visible count, the tree is cut a little deeper so the number of clusters still matches what you see on the map.
Colours are chosen to be as distinct from one another as possible across the whole map, and neighbouring communities in particular are given strongly contrasting colours, so the boundaries are easy to read. There is no geographic constraint in the clustering itself — communities are usually contiguous because connectedness falls off with distance, but a genuinely strong long-distance tie (for example, migration links) can place non-adjacent regions in the same community.
The Animate button steps from one community up to the number of clusters you chose, splitting one community at a time: it highlights the community about to split, shows the split, then restores the full colouring — so you can follow exactly how the hierarchy unfolds. Choose Automatic to play it through on its own, or Manual to pause and step Back / Next through the splits yourself.