简体   繁体   English

为 Python 删除 igraph 中的多条边

[英]Delete multiple edges in igraph for Python

I have a problem removing multiple edges in igraph using Python.我在使用 Python 删除 igraph 中的多个边时遇到问题。
I have tried this, but it does not work:我试过这个,但它不起作用:

for e in g.es:
    if e.is_multiple() is True:
        g.es.delete(e)

I even tried我什至试过

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)

Is there another solution?还有其他解决方案吗?

Try this:尝试这个:

def simplify(multiple=True, loops=True, combine_edges=None):

it is a function from the API.它是来自 API 的函数。

multiple -> whether to remove multiple edges. multiple -> 是否删除多条边。

read more here:在这里阅读更多:

https://igraph.org/python/doc/api/igraph._igraph.GraphBase.html#simplify https://igraph.org/python/doc/api/igraph._igraph.GraphBase.html#simplify

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM