MCPcopy
hub / github.com/networkx/networkx / remove_edge

Method remove_edge

networkx/algorithms/planarity.py:1199–1238  ·  view source on GitHub ↗

Remove the edge between u and v. Parameters ---------- u, v : nodes Remove the half-edges (u, v) and (v, u) and update the edge ordering around the removed edge. Raises ------ NetworkXError If there is not an edge between u an

(self, u, v)

Source from the content-addressed store, hash-verified

1197 self.add_half_edge(start_node, end_node, ccw=reference_neighbor)
1198
1199 def remove_edge(self, u, v):
1200 """Remove the edge between u and v.
1201
1202 Parameters
1203 ----------
1204 u, v : nodes
1205 Remove the half-edges (u, v) and (v, u) and update the
1206 edge ordering around the removed edge.
1207
1208 Raises
1209 ------
1210 NetworkXError
1211 If there is not an edge between u and v.
1212
1213 See Also
1214 --------
1215 remove_edges_from : remove a collection of edges
1216 """
1217 try:
1218 succs_u = self._succ[u]
1219 succs_v = self._succ[v]
1220 uv_cw = succs_u[v]["cw"]
1221 uv_ccw = succs_u[v]["ccw"]
1222 vu_cw = succs_v[u]["cw"]
1223 vu_ccw = succs_v[u]["ccw"]
1224 del succs_u[v]
1225 del self._pred[v][u]
1226 del succs_v[u]
1227 del self._pred[u][v]
1228 if v != uv_cw:
1229 succs_u[uv_cw]["ccw"] = uv_ccw
1230 succs_u[uv_ccw]["cw"] = uv_cw
1231 if u != vu_cw:
1232 succs_v[vu_cw]["ccw"] = vu_ccw
1233 succs_v[vu_ccw]["cw"] = vu_cw
1234 except KeyError as err:
1235 raise nx.NetworkXError(
1236 f"The edge {u}-{v} is not in the planar embedding."
1237 ) from err
1238 nx._clear_cache(self)
1239
1240 def remove_edges_from(self, ebunch):
1241 """Remove all edges specified in ebunch.

Callers 15

remove_edges_fromMethod · 0.95
dedensifyFunction · 0.45
directed_edge_swapFunction · 0.45
double_edge_swapFunction · 0.45
spannerFunction · 0.45
_undirected_cycle_searchFunction · 0.45
recursive_simple_cyclesFunction · 0.45
random_referenceFunction · 0.45
lattice_referenceFunction · 0.45
kl_connected_subgraphFunction · 0.45
is_kl_connectedFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected