dynetx.DynDiGraph.interactions_per_snapshots

DynDiGraph.interactions_per_snapshots(t=None)

Return the number of interactions within snapshot t.

Parameters

tsnapshot id (default=None)

If None will be returned total number of interactions across all snapshots

Returns

nddictionary, or number

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

Examples

>>> 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.add_interaction(0,4, t=1)
>>> G.add_interaction(4,5, t=1)
>>> G.add_interaction(5,6, t=1)
>>> G.add_interaction(7,1, t=2)
>>> G.add_interaction(1,2, t=2)
>>> G.add_interaction(2,3, t=2)
>>> G.interactions_per_snapshots(t=0)
3
>>> G.interactions_per_snapshots()
{0: 3, 1: 3, 2: 3}