Skip to content

healeycodes/country-borders

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

country-borders

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 networkx/matplotlib.pyplot
  • 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.

and displays:

A line of nodes, FR-DE-PL-RU-CN


The non-islands of the world

non-islands.py builds the same graphs, culls the islands, and displays:

A networked graph of all the non-islands


License

MIT.

This site or product includes Country Borders data available from https://www.geodatasource.com

About

🗺️ Calculating the path between two countries with the least border crossings.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages