Minimalistic World Coloring

We try to use the minimal number of colors for world coloring so that any two neighboring countries are colored differently. Due to the four color theorem, four colors should be enough, but since there are enclaves and exclaves, the theorem cannot be applied. So here we use the greedy coloring algorithm from the networkx package that provides us with the five-colored world.

Note: here we disregard sea borders and only take land borders into account.

Data was provided by GeoDataSource, see their repository.

In [1]:
import pandas as pd
import geopandas as gpd
import networkx as nx

from lets_plot import *
LetsPlot.setup_html()