

def add_edge(self, u, v, attr_dict=None, **attr):
    "Add an edge between u and v.\n\n        The nodes u and v will be automatically added if they are\n        not already in the graph.\n\n        Edge attributes can be specified with keywords or by providing\n        a dictionary with key/value pairs.  See examples below.\n\n        Parameters\n        ----------\n        u,v : nodes\n            Nodes can be, for example, strings or numbers.\n            Nodes must be hashable (and not None) Python objects.\n        attr_dict : dictionary, optional (default= no attributes)\n            Dictionary of edge attributes.  Key/value pairs will\n            update existing data associated with the edge.\n        attr : keyword arguments, optional\n            Edge data (or labels or objects) can be assigned using\n            keyword arguments.\n\n        See Also\n        --------\n        add_edges_from : add a collection of edges\n\n        Notes\n        -----\n        Adding an edge that already exists updates the edge data.\n\n        Many NetworkX algorithms designed for weighted graphs use as\n        the edge weight a numerical value assigned to a keyword\n        which by default is 'weight'.\n\n        Examples\n        --------\n        The following all add the edge e=(1,2) to graph G:\n\n        >>> G = nx.Graph()   # or DiGraph, MultiGraph, MultiDiGraph, etc\n        >>> e = (1,2)\n        >>> G.add_edge(1, 2)           # explicit two-node form\n        >>> G.add_edge(*e)             # single edge as tuple of two nodes\n        >>> G.add_edges_from( [(1,2)] ) # add edges from iterable container\n\n        Associate data to edges using keywords:\n\n        >>> G.add_edge(1, 2, weight=3)\n        >>> G.add_edge(1, 3, weight=7, capacity=15, length=342.7)\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 (u not in self.succ):
        self.succ[u] = {
            
        }
        self.pred[u] = {
            
        }
        self.node[u] = {
            
        }
    if (v not in self.succ):
        self.succ[v] = {
            
        }
        self.pred[datadict] = {
            
        }
        self.node[v] = {
            
        }
    datadict = self.adj[u].get(v, {
        
    })
    datadict.update(attr_dict)
    self.succ[u][v] = datadict
    self.pred[v][u] = datadict

dataset/ETHPy150Open networkx/networkx/networkx/classes/tests/timingclasses.py TimingDiGraph.add_edge/VarMisuse@143/811 `v`->`datadict`