

def remove_node(self, n):
    'Remove node n.\n\n        Removes the node n and all adjacent edges.\n        Attempting to remove a non-existent node will raise an exception.\n\n        Parameters\n        ----------\n        n : node\n           A node in the graph\n\n        Raises\n        -------\n        NetworkXError\n           If n is not in the graph.\n\n        See Also\n        --------\n        remove_nodes_from\n\n        Examples\n        --------\n        >>> G = nx.Graph()   # or DiGraph, MultiGraph, MultiDiGraph, etc\n        >>> G.add_path([0,1,2])\n        >>> G.edges()\n        [(0, 1), (1, 2)]\n        >>> G.remove_node(1)\n        >>> G.edges()\n        []\n\n        '
    adj = self.adj
    try:
        nbrs = list(adj[n].keys())
        del self.node[n]
    except KeyError:
        raise NetworkXError(('The node %s is not in the graph.' % (n,)))
    for u in nbrs:
        del adj[u][n]
    del adj[n]

dataset/ETHPy150Open networkx/networkx/networkx/classes/tests/timingclasses.py TimingGraph.remove_node/original