NetworkX

Previous topic

networkx.DiGraph.add_nodes_from

Next topic

networkx.DiGraph.remove_nodes_from

Quick search

networkx.DiGraph.remove_node

DiGraph.remove_node(n)

Remove node n.

Removes the node n and adjacent edges in the graph. Attempting to remove a non-existent node will raise an exception.

Examples

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