dynetx.classes.function.interactions¶
-
dynetx.classes.function.
interactions
(G, nbunch=None, t=None)¶ Return the list of edges present in a given snapshot.
Edges are returned as tuples in the order (node, neighbor).
Parameters: - G (Graph opject) – DyNetx graph object
- nbunch (iterable container, optional (default= all nodes)) – A container of nodes. The container will be iterated through once.
- t (snapshot id (default=None)) – If None the the method returns all the edges of the flattened graph.
Returns: edge_list – Edges that are adjacent to any node in nbunch, or a list of all edges if nbunch is not specified.
Return type: list of edge tuples
Notes
Nodes in nbunch that are not in the graph will be (quietly) ignored. For directed graphs this returns the out-edges.
Examples
>>> G = dn.DynGraph() >>> G.add_path([0,1,2], t=0) >>> G.add_edge(2,3, t=1) >>> dn.interactions(G, t=0) [(0, 1), (1, 2)] >>> dn.interactions(G) [(0, 1), (1, 2), (2, 3)] >>> dn.interactions(G, [0,3], t=0) [(0, 1)]