问题
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