An example of implementing Newman's modularity algorithm in Python 3, calculating the modularity score for Zachary's Karate Network.
N.B. The computed modularity score is 0.393. This is the correct modularity score without the extra optimisation step recommended in Newman's paper.
This is a self contained example. Ensure you have numpy
installed, and run with python newman_example.py