networkx 2.8.2 Pypi GitHub Homepage
Other Docs
ParametersRaisesBackRef
remove_edge(self, u, v, key=None)

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 (arbitrary) edge between u and v.

Raises

NetworkXError

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

Remove an edge between u and v.

See Also

remove_edges_from

remove a collection of edges

Examples

>>> G = nx.MultiGraph()
... nx.add_path(G, [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.MultiGraph()  # or MultiDiGraph, etc
... G.add_edges_from([(1, 2), (1, 2), (1, 2)]) # key_list returned [0, 1, 2]
>>> G.remove_edge(1, 2)  # remove a single (arbitrary) edge
... G.remove_edge(2, 1) # edges are not directed

For edges with keys

>>> G = nx.MultiGraph()  # or MultiDiGraph, etc
... G.add_edge(1, 2, key="first") 'first'
>>> G.add_edge(1, 2, key="second")
'second'
>>> G.remove_edge(1, 2, key="second")
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

networkx.classes.multigraph.MultiGraph.remove_edge networkx.classes.multigraph.MultiGraph.remove_edges_from

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /networkx/classes/multigraph.py#590
type: <class 'function'>
Commit: