dynetx.classes.function.interactions_per_snapshots

dynetx.classes.function.interactions_per_snapshots(G, t=None)

Return the number of interactions within snapshot t.

Parameters:
  • G (graph) – A DyNetx graph.
  • t (snapshot id (default=None)) – If None will be returned total number of interactions across all snapshots
Returns:

nd – A dictionary with snapshot ids as keys and interaction count as values or a number if a single snapshot id is specified.

Return type:

dictionary, or number

Examples

>>> G = dn.DynGraph()
>>> G.add_path([0,1,2,3], t=0)
>>> G.add_path([0,4,5,6], t=1)
>>> G.add_path([7,1,2,3], t=2)
>>> dn.number_of_interactions(G, t=0)
3
>>> dn.interactions_per_snapshots(G)
{0: 3, 1: 3, 2: 3}