The preceding examples used the modularity-based Clauset-Newman-Moore method for finding communities, which is only one of many existing community detection algorithms. NetworkX supports several others, which may be more appropriate in some cases. For example, the Girvan-Newman algorithm works by first assigning all nodes to a single large community and repeatedly splitting it into smaller communities.
In particular, the Girvan-Newman method is based on betweenness centrality (discussed in Chapter 5, The Small Scale – Nodes and Centrality). Betweenness centralities are first assigned to edges, and then the most central edges are removed until one of the communities is divided into two. This procedure ...