R igraph 手册页

如果您从 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))

[包 igraph 版本 1.3.5 索引]