dynetx.DynGraph.has_interaction

DynGraph.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)

>>> G = nx.Graph()
>>> G.add_path([0,1,2,3], t=0)
>>> G.has_interaction(0,1, t=0)
True
>>> G.has_interaction(0,1, t=1)
False