My paper on weighted modularity in bipartite networks has just been published online in the journal Royal Society Open Science. The code used to perform the analysis (in R) and the core algorithms (in R, Julia and MATLAB/Octave languages) are up on GitHub (archived on Zenodo*).

Example of a bipartite network, which represents the interactions between two classes of nodes (red and blue).
The aim is to be able to classify a bipartite network (made from interactions between two classes of nodes) into distinct communities aka modules, based on the strength of interactions between nodes (as opposed to just knowing which nodes are interacting or not – which is more commonly used). I use an example dataset of 23 plant-pollinator interaction networks (which show the number of visitations of pollinator species to plant species) to pit three modularity maximising algorithms (QuanBiMo, LPAwb+ and DIRTLPAwb+) against one another. Both binary and weighted forms of these networks were tested (making a total of 46 networks). QuanBiMo is available in the R library bipartite (as the function computeModules) and is based on simulated annealing approaches, whereas LPAwb+ and DIRTLPAwb+ (available as accompanying software to this paper) are based on label propagation methods.
Whilst the dataset is composed of plant-pollinator networks, these algorithms could be applied to any type of bipartite network in ecology, sociology or elsewhere. There are several known challenges associated with identifying community structures in networks, some of which I raise in my discussion. Finding appropriate methods for this problem is therefore important.

Each of the three algorithms (QuanBiMo, LPAwb+, DIRTLPAwb+) was run on each network 100 times. The maximum modularity score (from all algorithms) is plotted against the median modularity score for both binary (left) and weighted (right) versions of the 23 plant-pollinator networks. The dotted line indicates the ‘perfect case’ when a modularity algorithm is able to find the maximum modularity score every time it is used.
I find:
– Modular structures in binary networks can appear very different to the modular structures identified using weighted interactions — there may be value in evaluating both of these structures
– In general all three algorithms had strong agreement on smaller networks, but QuanBiMo performed less well (with the default arguments) on larger networks — it is hard to relate appropriate input parameters for QuanBiMo to the properties of the network under investigation
– DIRTLPAwb+ identified the community structure with the highest modularity score in all but 2 networks — DIRTLPAwb+ uses multiple initialisations of LPAwb+ from different initial modular configurations to achieve this
– There was more variability in the modularity scores returned by QuanBiMo than LPAwb+ or DIRTLPAwb+ — it may be necessary to run modularity algorithms multiple times on a network to achieve a robust result as modularity maximising algorithms tend to be stochastic
– LPAwb+ is very fast in comparison to the alternative algorithms and returns modularity scores close to the maximum found — it would be good for exploratory research, especially in large networks, or sanity checking QuanBiMo modularity scores
LPAwb+ and DIRTLPAwb+ provide additional methods for calculating weighted bipartite modularity than QuanBiMo – and highlight potential dangers of relying on one method. While I expect there may be other and potentially better ways of maximising weighted modularity for bipartite networks (some of which may be simple extensions of existing methods for binary networks) I hope LPAwb+ and DIRTLPAwb+ can be useful tools for those wishing to perform network analysis. You can read the paper here.
* giving code and other supplementary materials a DOI is critical to making them a persistent resource – it also allows these materials to be citable. If you aren’t you should be! I think I’ll write a blog post on this topic soon.