This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.


MultiDiGraph.remove_edge(u, v, key=None)

Remove an edge between u and v.

Parameters :

u,v: nodes

Remove an edge between nodes u and v.

key : hashable identifier, optional (default=None)

Used to distinguish multiple edges between a pair of nodes. If None remove a single (abritrary) edge between u and v.

Raises :


If there is not an edge between u and v, or if there is no edge with the specified key.

See also

remove a collection of edges


>>> G = nx.MultiDiGraph()
>>> G.add_path([0,1,2,3])
>>> G.remove_edge(0,1)
>>> e = (1,2)
>>> G.remove_edge(*e) # unpacks e from an edge tuple

For multiple edges

>>> G = nx.MultiDiGraph()
>>> G.add_edges_from([(1,2),(1,2),(1,2)])
>>> G.remove_edge(1,2) # remove a single (arbitrary) edge

For edges with keys

>>> G = nx.MultiDiGraph()
>>> G.add_edge(1,2,key='first')
>>> G.add_edge(1,2,key='second')
>>> G.remove_edge(1,2,key='second')