Graphs and Networks in Python

With Networkx

Keno Leon
5 min readJun 6, 2022

--

Every now and then you might find a problem that needs you to think in terms of graphs or networks, at first you might grab pen an paper to draw and figure things out conceptually ( something I recommend and practice ) and after that you might want to implement or formalize your ideas in code and this is where I found myself recently, after a little searching I found networkx which ( in their words ) is a package for the creation, manipulation, and study of the structure, dynamics, and functions of complex networks.

👋 Hi there 👋 all my content is free for Medium subscribers, if you are already a subscriber I just wanted to say thank you! 🎉 If not and you are considering subscribing, you can use my membership referral link, you will be supporting this and other high quality content, Thank you! ⭐️ Subscribe to Medium! ⭐️

In my case I just wanted a way to illustrate some graphs but NetworkX seems to also provide support for data structures and node/vertice content which could save me and you a lot of time, so come along for a narrated introduction based on my experience.

⚠️ Some experience with graphs is helpful, but this is mostly a beginner friendly post, if you need to review the basics check the wiki on graphs :https://en.wikipedia.org/wiki/Graph_(discrete_mathemat

--

--

Keno Leon
Keno Leon

No responses yet