Graph.clear_edges#

Graph.clear_edges()[source]#

从图中移除所有边,但不改变节点。

Examples

>>> G = nx.path_graph(4)  # or DiGraph, MultiGraph, MultiDiGraph, etc
>>> G.clear_edges()
>>> list(G.nodes)
[0, 1, 2, 3]
>>> list(G.edges)
[]