【发布时间】:2015-03-16 16:32:20
【问题描述】:
我正在尝试创建一个修剪过的子图,其中包含来自具有高中介中心性的图的顶点。
这是我的方法:
>>> import igraph as ig
>>> import numpy as np
>>> ig.summary(graph)
IGRAPH DNW- 9358 35488 --
+ attr: id (v), label (v), name (v), weight (e)
>>> btwn = graph.betweenness(weights='weight')
>>> ntile = np.percentile(btwn, 95)
>>> pruned_vs = graph.vs.select([v >= ntile for v in btwn])
>>> pruned_graph = graph.subgraph(pruned_vs)
一切运行良好。但是,生成的子图构造不正确。
>>> ig.summary(pruned_graph)
IGRAPH DNW- 0 0 --
+ attr: id (v), label (v), name (v), weight (e)
我尝试将implementation 属性更改为subgraph,但这并没有帮助。我错过了什么?
【问题讨论】: