Graph.remove_edges_from#

Graph.remove_edges_from(ebunch)[源代码]#

删除ebunch中指定的所有边缘。

参数
ebunch: list or container of edge tuples

列表或容器中给出的每条边都将从图表中删除。边可以是:

  • U和V之间的2元组(U,V)边。

  • 三元组(u,v,k),其中k被忽略。

参见

remove_edge

删除单个边缘

笔记

如果ebunch中的边不在图表中,则会自动失败。

实例

>>> G = nx.path_graph(4)  # or DiGraph, MultiGraph, MultiDiGraph, etc
>>> ebunch = [(1, 2), (2, 3)]
>>> G.remove_edges_from(ebunch)