gpt4 book ai didi

python - 删除 igraph for Python 中的多条边

转载 作者:行者123 更新时间:2023-12-05 05:26:13 29 4
gpt4 key购买 nike

我在使用 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)

还有其他解决方案吗?

最佳答案

试试这个:

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

它是 API 的一个函数。

multiple -> 是否去除多条边。

在这里阅读更多:

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

关于python - 删除 igraph for Python 中的多条边,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27172505/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com