我收到这个错误:
AttributeError: 'list' object has no attribute 'clear'
尝试在 this page 处执行示例时
例子是:
>>> g = gt.collection.data["power"]
>>> bstack, mdl = gt.minimize_nested_blockmodel_dl(g, deg_corr=True)
>>> t = gt.get_hierarchy_tree(bstack)[0]
>>> tpos = pos = gt.radial_tree_layout(t, t.vertex(t.num_vertices() - 1), weighted=True)
>>> cts = gt.get_hierarchy_control_points(g, t, tpos)
>>> pos = g.own_property(tpos)
>>> b = bstack[0].vp["b"]
>>> gt.graph_draw(g, pos=pos, vertex_fill_color=b, vertex_shape=b, edge_control_points=cts,
... edge_color=[0, 0, 0, 0.3], vertex_anchor=0, output="power_nested_mdl.pdf")
<...>
它在运行该行时给了我异常:
>>> bstack, mdl = gt.minimize_nested_blockmodel_dl(g, deg_corr=True)
有什么线索吗?
谢谢
请您参考如下方法:
list.clear() 不在 Python 2 中,只在 Python 3 中。该示例在 Python 3 中运行没有问题。
无论如何,graph-tool 应该在 Python 2.7 及更高版本上工作,所以这也可能被报告为一个错误。
