dynetworkx.IntervalGraph.remove_edge

IntervalGraph.remove_edge(u, v, begin=None, end=None, overlapping=True)

Remove the edge between u and v in the interval graph, during the given interval.

Quiet if the specified edge is not present.

Parameters:
  • v (u,) – Nodes can be, for example, strings or numbers. Nodes must be hashable (and not None) Python objects.
  • begin (int or float, optional (default= beginning of the entire interval graph)) – Inclusive beginning time of the edge appearing in the interval graph.
  • end (int or float, optional (default= end of the entire interval graph + 1)) – Non-inclusive ending time of the edge appearing in the interval graph. Must be bigger than or equal to begin. Note that the default value is shifted up by 1 to make it an inclusive end.
  • overlapping (bool, optional (default= True)) – if True, remove the edge between u and v with overlapping interval with begin and end. if False, remove the edge between u and v with the exact interval. Note: if False, both begin and end must be defined, otherwise an exception is raised.
Raises:

NetworkXError – If begin and end are not defined and overlapping= False

Examples

>>> G = dnx.IntervalGraph()
>>> G.add_edges_from([(1, 2, 3, 10), (2, 4, 1, 11), (6, 4, 5, 9), (1, 2, 8, 15)])
>>> G.remove_edge(1, 2)
>>> G.has_edge(1, 2)
False

With specific overlapping interval

>>> G = dnx.IntervalGraph()
>>> G.add_edges_from([(1, 2, 3, 10), (2, 4, 1, 11), (6, 4, 5, 9), (1, 2, 8, 15)])
>>> G.remove_edge(1, 2, begin=2, end=4)
>>> G.has_edge(1, 2, begin=2, end=4)
False
>>> G.has_edge(1, 2)
True

Exact interval match

>>> G.remove_edge(2, 4, begin=1, end=11, overlapping=False)
>>> G.has_edge(2, 4, begin=1, end=11)
False