此函数尝试通过随机游走在图中找到密集连接的子图,也称为社群。其思想是短随机游走倾向于停留在同一个社群中。
用法
cluster_walktrap(
graph,
weights = NULL,
steps = 4,
merges = TRUE,
modularity = TRUE,
membership = TRUE
)
参数
- graph
输入的图。在有向图中,边的方向被忽略。
- weights
边的权重。它必须是一个正数值向量、
NULL
或NA
。如果它是NULL
并且输入图具有 ‘weight’ 边属性,则将使用该属性。如果为NULL
且不存在此类属性,则边将具有相等的权重。如果该图具有 ‘weight’ 边属性,但您不想将其用于社群检测,请将其设置为NA
。较大的边权重会增加随机游走者选择边的概率。换句话说,较大的边权重对应于更强的连接。- steps
要执行的随机游走的长度。
- merges
逻辑标量,是否在结果中包含合并矩阵。
- modularity
逻辑标量,是否在结果中包含模块化分数的向量。如果
membership
参数为 true,则始终会计算它。- membership
逻辑标量,是否计算对应于最高模块化值的分割的成员向量。
值
cluster_walktrap()
返回一个 communities()
对象,有关详细信息,请参见 communities()
手册页。
详细信息
此函数是 Walktrap 社群发现算法的实现,请参见 Pascal Pons, Matthieu Latapy: Computing communities in large networks using random walks, https://arxiv.org/abs/physics/0512106
参考文献
Pascal Pons, Matthieu Latapy: Computing communities in large networks using random walks, https://arxiv.org/abs/physics/0512106
参见
请参见 communities()
以获取实际的成员向量、合并矩阵、模块化分数等。
参见 modularity()
和 cluster_fast_greedy()
, cluster_spinglass()
, cluster_leading_eigen()
, cluster_edge_betweenness()
, cluster_louvain()
, 和 cluster_leiden()
以获取其他社群检测方法。
社群检测 as_membership()
, cluster_edge_betweenness()
, cluster_fast_greedy()
, cluster_fluid_communities()
, cluster_infomap()
, cluster_label_prop()
, cluster_leading_eigen()
, cluster_leiden()
, cluster_louvain()
, cluster_optimal()
, cluster_spinglass()
, compare()
, groups()
, make_clusters()
, membership()
, modularity.igraph()
, plot_dendrogram()
, split_join_distance()
, voronoi_cells()
作者
Pascal Pons (http://psl.pons.free.fr/) 和 Gabor Csardi csardi.gabor@gmail.com 用于 R 和 igraph 接口
示例
g <- make_full_graph(5) %du% make_full_graph(5) %du% make_full_graph(5)
g <- add_edges(g, c(1, 6, 1, 11, 6, 11))
cluster_walktrap(g)
#> IGRAPH clustering walktrap, groups: 3, mod: 0.58
#> + groups:
#> $`1`
#> [1] 11 12 13 14 15
#>
#> $`2`
#> [1] 6 7 8 9 10
#>
#> $`3`
#> [1] 1 2 3 4 5
#>