如果您从 R 中使用 igraph,请使用此选项
as_membership {igraph} | R 文档 |
如果您想使用在成员向量上定义的函数,但您的成员向量并非来自 igraph 聚类方法,这将非常有用。
as_membership(x)
x |
输入向量。 |
输入向量,并添加 membership
类。
## Compare to the correct clustering
g <- (make_full_graph(10) + make_full_graph(10)) %>%
rewire(each_edge(p = 0.2))
correct <- rep(1:2, each = 10) %>% as_membership
fc <- cluster_fast_greedy(g)
compare(correct, fc)
compare(correct, membership(fc))