networkx.Graph.add_node
networkx.Graph.remove_node
Add nodes from nbunch.
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.Graph() >>> G.add_nodes_from('Hello') >>> K3=nx.complete_graph(3) >>> G.add_nodes_from(K3) >>> sorted(G.nodes()) [0, 1, 2, 'H', 'e', 'l', 'o']