Extending modularity by incorporating distance functions in the null model

Modularity is a widely used measure for evaluating community structure in networks. The definition of modularity involves a comparison of the fraction of within-community edges in the observed network and a null model. In the original definition the null model only considers the node degree to rewire edges randomly, failing to be a good representation of many real-world networks. To handle this problem, we incorporate distance functions in the null model to facilitate edges between certain nodes while respecting the degree factor. This enables us to create a framework for generating appropriate modularities adapted to various networks.