#

Note

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

#

networkx.Graph.remove_nodes_from

Graph.remove_nodes_from(nodes)[source]

Remove multiple nodes.

Parameters

nodes (iterable container) – A container of nodes (list, dict, set, etc.). If a node in the container is not in the graph it is silently ignored.

See also

remove_node()

Examples

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