Check which community a node belongs in louvain community detection

人盡茶涼 提交于 2021-02-10 15:47:52

问题


So I have run louvain detection on my dataset and returns a bunch of communities with nodes included. My question is, given a node, how do you find which community it belongs to? Thanks.


回答1:


The community for each node is stored in the membership component of the result.

library(igraph)
set.seed(1234)
G = erdos.renyi.game(16, 0.22)
C = cluster_louvain(G)
plot(G, vertex.color=rainbow(3,alpha=0.4)[C$membership])



来源:https://stackoverflow.com/questions/52245816/check-which-community-a-node-belongs-in-louvain-community-detection

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