NetworkX

Previous topic

networkx.Graph.remove_node

Next topic

networkx.Graph.add_edge

Quick search

networkx.Graph.remove_nodes_from

Graph.remove_nodes_from(nbunch)

Remove nodes specified in nbunch.

Parameters:

nbunch : list, iterable

A container of nodes that will be iterated through once (thus it should be an iterator or be iterable). Each element of the container should be a valid node type: any hashable type except None.

Examples

>>> G=nx.complete_graph(3)  # complete graph on 3 nodes, K3
>>> e=G.nodes()
>>> e
[0, 1, 2]
>>> G.remove_nodes_from(e)
>>> G.nodes()
[]