

def add_nodes_from(self, nodes, **attr):
    "Add multiple nodes.\n\n        Parameters\n        ----------\n        nodes : iterable container\n            A container of nodes (list, dict, set, etc.).\n            OR\n            A container of (node, attribute dict) tuples.\n            Node attributes are updated using the attribute dict.\n        attr : keyword arguments, optional (default= no attributes)\n            Update attributes for all nodes in nodes.\n            Node attributes specified in nodes as a tuple\n            take precedence over attributes specified generally.\n\n        See Also\n        --------\n        add_node\n\n        Examples\n        --------\n        >>> G = nx.Graph()   # or DiGraph, MultiGraph, MultiDiGraph, etc\n        >>> G.add_nodes_from('Hello')\n        >>> K3 = nx.Graph([(0,1),(1,2),(2,0)])\n        >>> G.add_nodes_from(K3)\n        >>> sorted(G.nodes(),key=str)\n        [0, 1, 2, 'H', 'e', 'l', 'o']\n\n        Use keywords to update specific node attributes for every node.\n\n        >>> G.add_nodes_from([1,2], size=10)\n        >>> G.add_nodes_from([3,4], weight=0.4)\n\n        Use (node, attrdict) tuples to update attributes for specific\n        nodes.\n\n        >>> G.add_nodes_from([(1,dict(size=11)), (2,{'color':'blue'})])\n        >>> G.node[1]['size']\n        11\n        >>> H = nx.Graph()\n        >>> H.add_nodes_from(G.nodes(data=True))\n        >>> H.node[1]['size']\n        11\n\n        "
    for n in nodes:
        try:
            if (n not in self.node):
                self.adj[n] = {
                    
                }
                self.node[n] = attr.copy()
            else:
                self.node[n].update(attr)
        except TypeError:
            (nn, ndict) = n
            if (nn not in self.node):
                self.adj[nn] = {
                    
                }
                newdict = attr.copy()
                nodes.update(ndict)
                self.node[nn] = newdict
            else:
                olddict = self.node[nn]
                olddict.update(attr)
                olddict.update(ndict)

dataset/ETHPy150Open networkx/networkx/networkx/classes/tests/timingclasses.py TimingGraph.add_nodes_from/VarMisuse@129/667 `newdict`->`nodes`