【发布时间】:2015-01-26 03:49:43
【问题描述】:
我在使用 Python 删除 igraph 中的多条边时遇到问题。
这个我试过了,还是不行:
for e in g.es:
if e.is_multiple() is True:
g.es.delete(e)
我什至尝试过
for e in g.es:
if e.is_multiple() is True:
helptuple = e.tuple
source = helptuple[0]
target = helptuple[1]
eid = g.get_eid(source, target)
g.delete_edges(eid)
还有其他解决方案吗?
【问题讨论】:
-
我还可以欣赏基于以下内容的解决方案:
if not edge in edgelist: g.add_edge(e)
标签: python igraph graph-theory