如何为igraph社区检测提供权重[Python/C/R]

2024-09-29 23:18:28 发布

您现在位置:Python中文网/ 问答频道 /正文

当使用igraphcommuinity_leading_eigenvector时,假设已经创建了一个图g,如何将图g的权重列表传递给community_leading_eigenvector?在

community_leading_eigenvector(clusters=None, weights=None, arpack_options=None)


Tags: communitynone列表options权重clustersweightsigraph
1条回答
网友
1楼 · 发布于 2024-09-29 23:18:28

您可以将包含权重的属性的名称传递给weights参数,也可以使用g.es["weight"]将所有权重检索到一个列表中,然后将其传递给weights参数。因此,假设权重在weightedge属性中,这两种方法都足够了:

  1. g.community_leading_eigenvector(weights="weight")
  2. g.community_leading_eigenvector(weights=g.es["weight"])

相关问题 更多 >

    热门问题