NetworkX

Previous topic

networkx.Graph.add_cycle

Next topic

networkx.Graph.nodes

Quick search

networkx.Graph.clear

Graph.clear()

Remove all nodes and edges.

This also removes the name.

Examples

>>> G=nx.path_graph(4)
>>> G.clear()
>>> G.nodes()
[]
>>> G.edges()
[]