dynetx.DynDiGraph.has_interaction¶
- DynDiGraph.has_interaction(u, v, t=None)¶
Return True if the interaction (u,v) is in the graph at time t.
Parameters¶
- u, vnodes
Nodes can be, for example, strings or numbers. Nodes must be hashable (and not None) Python objects.
- tsnapshot id (default=None)
If None will be returned the presence of the interaction on the flattened graph.
Returns¶
- edge_indbool
True if interaction is in the graph, False otherwise.
Examples¶
Can be called either using two nodes u,v or interaction tuple (u,v)
>>> import dynetx as dn >>> G = dn.DynDiGraph() >>> G.add_interaction(0,1, t=0) >>> G.add_interaction(1,2, t=0) >>> G.add_interaction(2,3, t=0) >>> G.has_interaction(0,1, t=0) True >>> G.has_interaction(0,1, t=1) False