dynetx.DynDiGraph.in_interactions_iter

DynDiGraph.in_interactions_iter(nbunch=None, t=None)

Return an iterator over the in interactions present in a given snapshot.

Edges are returned as tuples in the order (node, neighbor).

Parameters

nbunchiterable container, optional (default= all nodes)

A container of nodes. The container will be iterated through once.

tsnapshot id (default=None)

If None the the method returns an iterator over the edges of the flattened graph.

Returns

edge_iteriterator

An iterator of (u,v) tuples of interaction.

Notes

Nodes in nbunch that are not in the graph will be (quietly) ignored. For directed graphs this returns the out-interaction.

Examples

>>> import dynetx as dn
>>> G = dn.DynDiGraph()
>>> G.add_interaction(0,1, 0)
>>> G.add_interaction(1,2, 0)
>>> G.add_interaction(2,3,1)
>>> [e for e in G.in_interactions_iter(t=0)]
[(0, 1), (1, 2)]
>>> list(G.in_interactions_iter())
[(0, 1), (1, 2), (2, 3)]