These scripts were used in the analysis presented in the paper:Timóteo, S. et al. 2018. Multilayer networks reveal the spatial structure of seed-dispersal interactions across the Great Rift landscapes. - Nat Commun 9: 140.
It includes code to estimate modularity of a multilayer network, an aggregated network, and individual habitats networks. It also estimates modularity for two different null models reshuffling intra-layer links, and inter-layer links. Both null models were used with the multilayer network, and the intra-layer null model was also used with the aggregated network.
This code builds on the work by the following 1) Pilosof, S., Porter, M. A., Pascual, M. & Kéfi, S. The multilayer nature of ecological networks. Nat. Ecol. Evol. 1, 101 (2017), for the overall approach to multilayer modularity analysis. Most of the MATLAB code presented here was adapted from their work and the code they made available. - 2) Jutlla, I. S., Jeub, L. G. & Mucha, P. J. A generalized Louvain method for community detection implemented in MATLAB. (2014), for the code chuncks necessary to run the multilayer modularity analisys. These bits are necessary to run the modularity analysis of the spatial multilayer network. This adapts modularity quality function for the "generalized Louvian method" for community finding to reflect the bipartite categorical nature of the Gorongosa spatial multilayer network, and are available at "
netwiki.amath.unc.edu".
Please give credit to any of these works when appropriate.