DynDiGraph.add_interaction(u, v, t=None, e=None)

Add an interaction between u and v at time t vanishing (optional) at time e.

The nodes u and v will be automatically added if they are not already in the graph.

Parameters: v (u,) – Nodes can be, for example, strings or numbers. Nodes must be hashable (and not None) Python objects. t (appearance snapshot id, mandatory) – e (vanishing snapshot id, optional (default=None)) –

add_edges_from()
add a collection of interaction at time t

Notes

Adding an interaction that already exists but with different snapshot id updates the interaction data.

Examples

The following all add the interaction e=(1,2, 0) to graph G:

>>> G = dn.DynDiGraph()
>>> G.add_interaction(1, 2, 0)
>>> G.add_interaction( [(1,2)], t=0 )


Specify the vanishing of the interaction

>>>> G.add_interaction(1, 3, t=1, e=10)

will produce an interaction present in snapshots [0, 9]