如何在igraph中为Louvain模块化设置分辨率参数? [英] How to set the resolution parameter for Louvain modularity in igraph?
问题描述
当使用函数 cluster_louvain 检测 igraph 中R的社区时,是否可以设置分辨率参数?由于此参数与节点之间的层次结构差异有关,因此其结果差异很大.谢谢.
最简单的方法是通过resolution
包(在此链接中可用) http://arxiv.org/pdf/0812.1770.pdf
它几乎具有2个功能cluster_resolution()
和cluster_resolution_RandomOrderFULL()
.
在这两种方法中,您都可以指定分辨率t
和想要的重复次数rep
.并且,您只需在函数中使用igraph对象即可.
cluster_resolution_RandomOrderFULL(g,t=0.5)
cluster_resolution_RandomOrderFULL(g,rep=20)
注意/虽然它将不接受已签名的网络!我正在尝试与代码所有者联系,或者自己对代码进行汇总以使其适合已签名的网络.
我能够从 Brain Connectivity Toolbox转换功能community_louvain.m 以将Matlab转换为R.
这是signed_louvain()
<<的 github链接. /p>
您几乎可以放下ex. signed_louvain(g, gamma = 1, mod = 'modularity')
它适用于igraph或矩阵对象作为输入.如果它为负值,则必须选择mod = 'neg_sym'
或'neg_asym'
.
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.
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'
.
这篇关于如何在igraph中为Louvain模块化设置分辨率参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!