Note

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

networkx.MultiGraph.clear_edges

MultiGraph.clear_edges()

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)
[]