dynetx.DynGraph.interactions

DynGraph.interactions(nbunch=None, t=None)

Return the list of interaction 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 all the edges of the flattened graph.

Returns

interaction_list: list of interaction tuples

Interactions that are adjacent to any node in nbunch, or a list of all interactions if nbunch is not specified.

See Also

edges_iter : return an iterator over the interactions

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.DynGraph()
>>> G.add_path([0,1,2], t=0)
>>> G.add_edge(2,3, t=1)
>>> G.interactions(t=0)
[(0, 1), (1, 2)]
>>> G.interactions()
[(0, 1), (1, 2), (2, 3)]
>>> G.interactions([0,3], t=0)
[(0, 1)]