dynetx.DynGraph.number_of_interactions

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

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

Parameters

u, vnodes, optional (default=all interaction)

If u and v are specified, return the number of interaction between u and v. Otherwise return the total number of all interaction.

tsnapshot id (default=None)

If None will be returned the number of edges on the flattened graph.

Returns

nedgesint

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.

See Also

size

Examples

>>> import dynetx as dn
>>> G = dn.DynGraph()
>>> 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