在Python的igraph中删除多个边

3

我在使用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) - bioinfo_programer
3
请参见 http://igraph.org/python/doc/igraph.GraphBase-class.html#simplify。 - Gabor Csardi
1个回答

2

虽然这个链接可能回答了问题,但最好在此处包含答案的基本部分并提供参考链接。如果链接页面更改,仅有链接的答案可能会失效。-【来自审查】 - Linux Geek

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接