#

Note

This documents the development version of NetworkX. Documentation for the current release can be found here.

#

networkx.Graph.clear_edges

Graph.clear_edges()[source]

Remove all edges from the graph without altering nodes.

Examples

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