Network Analysis Made Simple
Welcome to the GitHub repository for Network Analysis Made Simple! This is a tutorial designed to teach you the basic and practical aspects of graph theory. It has been presented at multiple conferences (PyCon, SciPy, PyData, and ODSC) in a variety of formats (ranging from 1.5 hr to 4 hour long workshops). The material is designed for a live tutorial presentation, with the code available for you to reference afterwards.
(Consider this option only if your WiFi is stable)
If you don't want the hassle of getting setup, you can use the Binder service to participate in the live tutorial. Just click on the button below:
Notebook HTML Versions
For tutorial participants who may run into technical issues, full HTML versions of the notebooks are available to follow along during the tutorial.
- NB0: Pre-Tutorial Exercises
- NB1: Introduction
- NB2: Network Basics
- NB3: Hubs and Paths
- NB4: Cliques, Triangles and Structures
- NB5: Graph I/O
- NB6: Bipartite Graphs
- NB7: Case Study on Game Of Thrones
- NB8: Case Study on US Airports
- Bonus Notebook: Network Statistical Inference
- Bonus Notebook: Graph Matrix Representations
For those of you who would like to get setup beforehand and keep a local copy of the repository on your machine, follow along here.
Easiest way: Anaconda Distribution of Python
If you have the Anaconda distribution of Python 3 installed on a Unix-like machine (Linux, macOS, etc.), then run
make conda, which wraps the commands below.
$ conda env create -f environment.yml
$ source activate nams
$ python checkenv.py
If you do not have the Anaconda distribution, I would highly recommend getting it for Windows, Mac or Linux. It provides an isolated Python computing environment that will not interfere with your system Python installation, and comes with a very awesome package manager (
conda) that makes installation of new packages a single
conda install pkgname away.
If you're not using Python 3, then check out @jakevdp's talk at SciPy2015 to find out why!
Alternative to Anaconda:
For those who do not have the capability of installing the Anaconda Python 3 distribution on their computers, please follow the instructions below.
make venv, which wraps up the commands below. Special thanks to @matt-land for putting this script together.
- Create a virtual environment for this tutorial, so that the installed packages do not mess with your regular Python environment.
$ pip install virtualenv3.
$ virtualenv network4.
$ source network/bin/activate
$ pip install matplotlib networkx pandas hiveplot numpy jupyter
Check your environment:
$ python checkenv.py
For this tutorial, you will need the following packages:
- Python 3
conda install -c conda-forge hiveplotor
pip install hiveplot.
conda install -c conda-forge nxviz. (This implements Circos plots; HivePlots are being migrated over.)
Then, clone the repository locally.
$ cd /path/to/your/directory
- Clone the repository to disk:
$ git clone https://github.com/ericmjl/Network-Analysis-Made-Simple.git
$ cd Network-Analysis-Made-Simple
Run the Jupyter Notebook
$ jupyter notebook
Your browser will open to an index page where you can click on a notebook to run it. Test that everything runs fine by executing all of the cells in the Instructor versions of the notebooks.
Teaching with this repository material
If you would like to teach with this repository material, we request only the following:
- As far as possible, make a fork, not a new repository, but no hard restriction here.
- Ping us in the Issues tracker here.
- Please provide proper attribution back to the original in the primary landing page of derivative work (this would usually imply the
README) , with the following text:
This material has been adapted from the tutorial Network Analysis Made Simple created by Eric J. Ma and Mridul Seth. The original material can be found at: https://github.com/ericmjl/Network-Analysis-Made-Simple/.
- Please provide a lightweight overview of modifications to the original material documented in forked repository. (An example would be a plain text
HISTORYfile, or as a section in the forked README.)
- Loop back to us if there are recordings - so that we can link to them in the original repository! We would like to feature on here your efforts teaching with the material.
If you've attended this workshop, please leave feedback! It's important to help me improve the tutorial for future iterations.
If you get a "Python is not installed as a framework" error with matplotlib, please check out this issue for instructions to resolve it.
If you're facing difficulties, please report it as an issue on this repository.
- Jon Charest's use of Circos plots to visualize networks of Metal music genres. blog post | notebook
- Gain further practice by taking this course online at DataCamp!
- A gentle introduction to graph theory on Vaidehi Joshi's website
- If you're the kind who likes more hands-on practice, consider supporting our course on DataCamp!