dynetworkx.IntervalGraph.remove_node

IntervalGraph.remove_node(n, begin=None, end=None)

Remove the presence of a node n within the given interval.

Removes the presence node n and all adjacent edges within the given interval.

If interval is specified, all the edges of n will be removed within that interval.

Quiet if n is not in the interval graph.

Parameters:
  • n (node) – A node in the graph
  • begin (int or float, optional (default= beginning of the entire interval graph)) – Inclusive beginning time of the node appearing in the interval graph.
  • end (int or float, optional (default= end of the entire interval graph + 1)) – Non-inclusive ending time of the node 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.

Examples

>>> G.add_edges_from([(1, 2, 3, 10), (2, 4, 1, 11), (6, 4, 12, 19), (2, 4, 8, 15)])
>>> G.add_nodes_from([(1, {'time': '1pm'}), (2, {'time': '2pm'}), (4, {'time': '4pm'})])
>>> G.nodes(begin=4, end=6)
[1, 2, 4, 6]
>>> G.remove_node(2, begin=4, end=6)
>>> G.nodes(begin=4, end=6)
[4, 6]
>>> G.nodes(data=True)
[(1, {'time': '1pm'}), (2, {'time': '2pm'}), (4, {'time': '4pm'}), (6, {})]
>>> G.remove_node(2)
>>> G.nodes(data=True)
[(1, {'time': '1pm'}), (4, {'time': '4pm'}), (6, {})]