简体   繁体   中英

Delete multiple edges in igraph for Python

I have a problem removing multiple edges in igraph using Python.
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.

multiple -> whether to remove multiple edges.

read more here:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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