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:
  • v (u,) – Nodes can be, for example, strings or numbers. Nodes must be hashable (and not None) Python objects.
  • t (snapshot id (default=None)) – If None will be returned the presence of the interaction on the flattened graph.
Returns:

edge_ind – True if interaction is in the graph, False otherwise.

Return type:

bool

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