igraph community_optimal_modularity不带重量参数

时间:2014-07-01 15:40:05

标签: python graph igraph modularity weighted

我尝试使用python中igraph的community_optimal_modularity函数。文档

http://igraph.org/python/doc/igraph.Graph-class.html#community_optimal_modularity

http://igraph.org/python/doc/igraph.GraphBase-class.html#community_optimal_modularity

声称要提供关键字"权重"会考虑边缘权重。

不幸的是,它似乎没有:

import numpy as np
import igraph
gra = igraph.Graph.Full(10)
gra.es["weight"] = np.random.rand(gra.ecount())
gra.community_optimal_modularity(weights="weight")

导致" community_optimal_modularity()不带参数(给定1个)",而相同的代码在没有最后一个命令的关键字规范的情况下工作。我使用最近的igraph版本0.7.0。

是否可以通过最佳模块性来考虑社区检测中的权重?

1 个答案:

答案 0 :(得分:0)

尝试:

gra.community_optimal_modularity(weights= gra.es["weight"])

为我工作。