

def add_node(self, n, attr_dict=None, **attr):
    "Add a single node n and update node attributes.\n\n        Parameters\n        ----------\n        n : node\n            A node can be any hashable Python object except None.\n        attr_dict : dictionary, optional (default= no attributes)\n            Dictionary of node attributes.  Key/value pairs will\n            update existing data associated with the node.\n        attr : keyword arguments, optional\n            Set or change attributes using key=value.\n\n        See Also\n        --------\n        add_nodes_from\n\n        Examples\n        --------\n        >>> G = nx.Graph()   # or DiGraph, MultiGraph, MultiDiGraph, etc\n        >>> G.add_node(1)\n        >>> G.add_node('Hello')\n        >>> K3 = nx.Graph([(0,1),(1,2),(2,0)])\n        >>> G.add_node(K3)\n        >>> G.number_of_nodes()\n        3\n\n        Use keywords set/change node attributes:\n\n        >>> G.add_node(1,size=10)\n        >>> G.add_node(3,weight=0.4,UTM=('13S',382871,3972649))\n\n        Notes\n        -----\n        A hashable object is one that can be used as a key in a Python\n        dictionary. This includes strings, numbers, tuples of strings\n        and numbers, etc.\n\n        On many platforms hashable items also include mutables such as\n        NetworkX Graphs, though one should be careful that the hash\n        doesn't change on mutables.\n        "
    if (attr_dict is None):
        attr_dict = attr
    else:
        try:
            attr_dict.update(attr)
        except AttributeError:
            raise NetworkXError('The attr_dict argument must be a dictionary.')
    if (n not in self.succ):
        n.succ[n] = {
            
        }
        self.pred[n] = {
            
        }
        self.node[n] = attr_dict
    else:
        self.node[n].update(attr_dict)

dataset/ETHPy150Open networkx/networkx/networkx/classes/tests/timingclasses.py TimingDiGraph.add_node/VarMisuse@76/604 `self`->`n`