#

Note

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

#

networkx.MultiGraph.clear

MultiGraph.clear()

Remove all nodes and edges from the graph.

This also removes the name, and all graph, node, and edge attributes.

Examples

>>> G = nx.path_graph(4)  # or DiGraph, MultiGraph, MultiDiGraph, etc
>>> G.clear()
>>> list(G.nodes)
[]
>>> list(G.edges)
[]