Modularity [1]} is a function which takes a label assignment on the nodes of a network and returns a score evaluating how effectively the label assignment partitions the network into non-overlapping communities. Given a network with (weighted) adjacency matrix \(A_{ij}\)  and the labelling function \(c(i)\)  mapping nodes, \(i\) , to community labels, modularity is defined as
\(Q_{\text{Newman}} = \frac{1}{2E} \sum _{ij} \left( A_{ij} - \gamma \frac{k_i k_j}{2E} \right) \delta ( c(i), c(j) ).\) 
