dynetworkx.IntervalGraph.has_node¶
-
IntervalGraph.
has_node
(n, begin=None, end=None)¶ Return True if the interval graph contains the node n, during the given interval.
Identical to n in G when ‘begin’ and ‘end’ are not defined.
Parameters: - n (node) –
- 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 begin. Note that the default value is shifted up by 1 to make it an inclusive end.
Examples
>>> G = dnx.IntervalGraph() >>> G.add_ndoe(1) >>> G.has_node(1) True
It is more readable and simpler to use
>>> 0 in G True
With interval query:
>>> G.add_edge(3, 4, 2, 5) >>> G.has_node(3) True >>> G.has_node(3, begin=2) True >>> G.has_node(3, end=2) # end is non-inclusive False