

def remove_edge(self, u, v, key=None):
    "Remove an edge between u and v.\n\n        Parameters\n        ----------\n        u,v: nodes\n            Remove an edge between nodes u and v.\n        key : hashable identifier, optional (default=None)\n            Used to distinguish multiple edges between a pair of nodes.\n            If None remove a single (arbitrary) edge between u and v.\n\n        Raises\n        ------\n        NetworkXError\n            If there is not an edge between u and v, or\n            if there is no edge with the specified key.\n\n        See Also\n        --------\n        remove_edges_from : remove a collection of edges\n\n        Examples\n        --------\n        >>> G = nx.MultiDiGraph()\n        >>> G.add_path([0,1,2,3])\n        >>> G.remove_edge(0,1)\n        >>> e = (1,2)\n        >>> G.remove_edge(*e) # unpacks e from an edge tuple\n\n        For multiple edges\n\n        >>> G = nx.MultiDiGraph()\n        >>> G.add_edges_from([(1,2),(1,2),(1,2)])\n        >>> G.remove_edge(1,2) # remove a single (arbitrary) edge\n\n        For edges with keys\n\n        >>> G = nx.MultiDiGraph()\n        >>> G.add_edge(1,2,key='first')\n        >>> G.add_edge(1,2,key='second')\n        >>> G.remove_edge(1,2,key='second')\n\n        "
    try:
        d = self.adj[u][v]
    except KeyError:
        raise NetworkXError(('The edge %s-%s is not in the graph.' % (u, v)))
    if (key is None):
        d.popitem()
    else:
        try:
            del d[key]
        except KeyError:
            raise NetworkXError(('The edge %s-%s with key %s is not in the graph.' % (u, v, key)))
    if (len(d) == 0):
        del self.succ[u][v]
        del self.pred[v][u]

dataset/ETHPy150Open networkx/networkx/networkx/classes/tests/timingclasses.py TimingMultiDiGraph.remove_edge/original