Python的graph_tool中的加权度分布

时间:2015-01-14 21:19:21

标签: python graph-tool

在Pythons graph_tool中,是否有一种简单的方法来计算加权度分布(出局,进入或所有边缘的权重之和)?

Stats 包中, vertex_hist 会给出未加权的度数,度数和总度直方图,但似乎没有获得这些加权版的方法。

注意:我正在处理31,000个顶点和> 1千万条边。我正在寻找一种方法来尽可能地利用graph_tool。

1 个答案:

答案 0 :(得分:5)

是的,这很容易。您必须获取加权度数的属性映射,然后执行直方图:

d = g.degree_property_map("out", weight)   # weight is an edge property map
bins = linspace(d.a.min(), d.a.max(), 40)  # linear bins
h = vertex_hist(g, d, bins)