import networkx as nx graph = nx.Graph() graph.add_node('a') graph.nodes # NodeView(('a',)) graph.remove_node('a') # NodeView(())