How to set the resolution parameter for Louvain modularity in igraph?

风格不统一 提交于 2021-01-21 09:26:17

问题


is there a way to set the resolution parameter when using the function cluster_louvain to detect communities in igraph for R? It makes a lot of difference for the result, as this parameter is related to the hierarchical dissimilarity between nodes. Thank you.


回答1:


The easiest way to do it is through the resolution package, available in this link https://github.com/analyxcompany/resolution

It is based on this paper http://arxiv.org/pdf/0812.1770.pdf

It pretty much has 2 functions cluster_resolution() and cluster_resolution_RandomOrderFULL(). In both you can state the resolution t and how many repetitions you want rep. And, you can just use the igraph object in the function.

cluster_resolution_RandomOrderFULL(g,t=0.5)
cluster_resolution_RandomOrderFULL(g,rep=20)

NOTE/EDIT: it will not accept signed networks though! I'm trying to either contact the owner of the code or costumize it myself to make it suitable for signed networks.

EDIT2: I was able to translate the function community_louvain.m from the Brain Connectivity Toolbox for Matlab to R.

Here is the github link for the signed_louvain()

you can pretty much just put for ex. signed_louvain(g, gamma = 1, mod = 'modularity') it works with igraph or matrix objects as input. If it has negative values, you have to choose mod = 'neg_sym' or 'neg_asym'.



来源:https://stackoverflow.com/questions/43100556/how-to-set-the-resolution-parameter-for-louvain-modularity-in-igraph

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!