dynetworkx.IntervalGraph.has_edge¶
-
IntervalGraph.
has_edge
(u, v, begin=None, end=None, overlapping=True)¶ Return True if there exists an edge between u and v in the interval graph, during the given interval.
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 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.
- overlapping (bool, optional (default= True)) – if True, it returns True if there exists an edge between u and v with overlapping interval with begin and end. if False, it returns true only if there exists an 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= FalseExamples
>>> G = dnx.IntervalGraph() >>> G.add_edges_from([(1, 2, 3, 10), (2, 4, 1, 11)]) >>> G.has_edge(1, 2) True
With specific overlapping interval:
>>> G.has_edge(1, 2, begin=2) True >>> G.has_edge(2, 4, begin=12) False
Exact interval match:
>>> G.has_edge(2, 4, begin=1, end=11) True >>> G.has_edge(2, 4, begin=2, end=11) False