My blog post: https://healeycodes.com/practical-intro-to-graphs/
Calculating the path between two countries with the least border crossings.
This repository shows some examples of:
- Consuming CSV data and building multiple graphs
- Displaying graphs with
- Finding the shortest path (Breadth-First Search) between vertices (e.g. France to China)
- Building a graph of all the non-islands of the world
The shortest path between France and China
fr-to-cn.py builds multiple graphs and dynamically outputs:
France is connected to 8 countries. They are Andorra, Belgium, Germany, Italy, Luxembourg, Monaco, Spain, Switzerland. The shortest path from France to China is: France -> Germany -> Poland -> Russian Federation -> China.
The non-islands of the world
non-islands.py builds the same graphs, culls the islands, and displays:
This site or product includes Country Borders data available from https://www.geodatasource.com