dynetx.DynDiGraph.number_of_interactions

DynDiGraph.number_of_interactions(u=None, v=None, t=None)

Return the number of interaction between two nodes at time t.

Parameters:
  • v (u,) – If u and v are specified, return the number of interaction between u and v. Otherwise return the total number of all interaction.
  • t (snapshot id (default=None)) – If None will be returned the number of edges on the flattened graph.
Returns:

nedges – The number of interaction in the graph. If nodes u and v are specified return the number of interaction between those nodes. If a single node is specified return None.

Return type:

int

See also

size()

Examples

>>> G = dn.DynDiGraph()
>>> G.add_path([0,1,2,3], t=0)
>>> G.number_of_interactions()
3
>>> G.number_of_interactions(0,1, t=0)
1
>>> G.add_edge(3, 4, t=1)
>>> G.number_of_interactions()
4