computeModules: computeModules

View source: R/computeModules.R

computeModulesR Documentation

computeModules

Description

This function takes a bipartite weighted graph and computes modules by applying Newman's modularity measure in a bipartite weighted version to it. metaComputeModules re-runs the algorithm several times, returning the most modular result, to stabilise modularity computation.

Usage

computeModules(web, method="Beckett", deep = FALSE, deleteOriginalFiles = TRUE, 
	steps = 1000000, tolerance = 1e-10, experimental = FALSE, forceLPA=FALSE)
	
metaComputeModules(moduleObject, N=5, method="Beckett", ...)

Arguments

web

web is the matrix representing the weighted bipartite graph (as an example, see e.g. web small1976 in this package). This matrix can be binary (i.e. consist only of 0s and 1s), in which case the output will be Newman's (2006) modularity.

method

Choice between the algorithm(s) provided by Stephen Beckett (2016) or Dormann & Strauss (2016) (method="DormannStrauss"). Defaults to the much faster and in the majority of cases better algorithm of Beckett. (Note the optional argument forceLPA to use his slightly inferior but even faster pure LPA algorithm.)

deep

If deep is set to FALSE (default), a flat clustering is computed, otherwise submodules are identified recursively within modules. Works only with method="DormannnStrauss".

deleteOriginalFiles

If deleteOriginalFiles is set to TRUE (default), the files mentioned above in the description are deleted from the hard drive disk, otherwise not. Applies only to method="DormannnStrauss".

steps

steps is the number of steps after which the computation of modules stops if no better division into modules than the current one can be found. Applies only to method="DormannnStrauss".

tolerance

How small should the difference between MCMC-swap results be? At some point computer precision fluctuations make the algorithm fail to converge, which is why we choose a (very low) defaults of 1E-10. Applies only to method="DormannnStrauss".

experimental

Logical; using an undescribed and untested version for which no detail is available? (We suggest: not yet.) Applies only to method="DormannnStrauss".

moduleObject

Output from running computeModules.

forceLPA

Logical; should the even faster pure LPA-algorithm of Beckett be used? DIRT-LPA, the default, is less likely to get trapped in a local minimum, but is slightly slower. Defaults to FALSE. Applies only to method="Beckett".

N

Number of replicate runs; defaults to 5. Not really required for method="Beckett", which starts in different places anyway.

...

Arguments passed on to computeModules, which is called internally.

Value

An object of class "moduleWeb" containing information about the computed modules. For details, please refer to the corresponding documentation file.

Note

For perfectly compartmentalised networks the algorithm may throw an error message. Please add a little bit of noise (e.g. uniform between 0 and 1 or so) or a small constant (1E-5 or so) and it will work again.

When using the method DormannStrauss, files are written onto the hard drive during the computation. These files are by default deleted after the computation terminates, unless it breaks. Details of the modularity algorithm can be found in Dormann & Strauß (2013).

Author(s)

Rouven Strauss, with fixes by Carsten Dormann and Tobias Hegemann; modified to accommodate Beckett's algorithm by Carsten Dormann

References

Beckett, S.J. 2016 Improved community detection in weighted bipartite networks. Royal Society open science 3, 140536.

Dormann, C. F., and R. Strauß. 2014. Detecting modules in quantitative bipartite networks: the QuanBiMo algorithm. Methods in Ecology & Evolution 5 90–98 (and arXiv [q-bio.QM] 1304.3218.)

Liu X. & Murata T. 2010. An Efficient Algorithm for Optimizing Bipartite Modularity in Bipartite Networks. Journal of Advanced Computational Intelligence and Intelligent Informatics (JACIII) 14 408–415.

Newman M.E.J. 2004. Physical Review E 70 056131

Newman, M.E.J. 2006. Modularity and community structure in networks. Proceedings of the National Academy of Sciences of the United States of America, 103, 8577–-8582.

See Also

See also class "moduleWeb", plotModuleWeb, listModuleInformation, printoutModuleInformation, DIRT_LPA_wb_plus.

Examples

	## Not run: 
		data(small1976)
		(res <- computeModules(small1976)) 
		plotModuleWeb(res)
		
		# slow:
		res2 <- metaComputeModules(small1976, method="DormannStrauss")
		res2
	
## End(Not run)

bipartite documentation built on May 29, 2024, 2:23 a.m.