2024-09-29 23:18:28 发布
网友
当使用igraph的commuinity_leading_eigenvector时,假设已经创建了一个图g,如何将图g的权重列表传递给community_leading_eigenvector?在
commuinity_leading_eigenvector
community_leading_eigenvector
community_leading_eigenvector(clusters=None, weights=None, arpack_options=None)
您可以将包含权重的属性的名称传递给weights参数,也可以使用g.es["weight"]将所有权重检索到一个列表中,然后将其传递给weights参数。因此,假设权重在weightedge属性中,这两种方法都足够了:
weights
g.es["weight"]
weight
g.community_leading_eigenvector(weights="weight")
g.community_leading_eigenvector(weights=g.es["weight"])
您可以将包含权重的属性的名称传递给
weights
参数,也可以使用g.es["weight"]
将所有权重检索到一个列表中,然后将其传递给weights
参数。因此,假设权重在weight
edge属性中,这两种方法都足够了:g.community_leading_eigenvector(weights="weight")
g.community_leading_eigenvector(weights=g.es["weight"])
相关问题 更多 >
编程相关推荐