dynetx.classes.function.number_of_interactions(G, u=None, v=None, t=None)

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

  • G (a dynetx graph object) –
  • u (node, optional (default=all edges)) –
  • v (node, optional (default=all edges)) –
  • t (snapshot id (default=None)) – If None will be returned the number of edges on the flattened graph.
  • u and v are specified, return the number of edges between u and v. (If) –
  • return the total number of all edges. (Otherwise) –

nedges – The number of edges in the graph. If nodes u and v are specified return the number of edges between those nodes.

Return type:



>>> import dynetx as dn
>>> G = dn.DynGraph()
>>> G.add_path([0,1,2,3], t=0)
>>> dn.number_of_interactions(G, t=0)