我有一个使用图形工具的GraphView()
生成的过滤图。在
g = gt.GraphView(g, vfilt= label_largest_component(g, directed=False))
原始图g
有10069个顶点,而结果图有9197个顶点。但是,使用新的(过滤)图,当我使用indeg = g.degree_property_map("in")
列出in度时,list(indeg.a)
中的元素总数仍然是10069。当绘制带有9197个节点的新过滤图时,这就成了问题,其中顶点大小被设置为indeg
的函数,这主要是因为元素数量不匹配。在
代码片段如下所示
^{pr2}$当运行时,给出如下ValueError
ValueError: operands could not be broadcast together with shapes (10069,) (9197,)
为GraphView
对象添加预期样式的正确方法是什么?在
找到了解决办法。我首先创建了
GraphView
对象的副本,然后清除了这个copy的顶点。注意,为了清晰起见,我引入了一个新变量gc
,而不是保留变量名g
。在相关问题 更多 >
编程相关推荐