dynetx.DynDiGraph.nodes¶
- DynDiGraph.nodes(t=None, data=False)¶
Return a list of the nodes in the graph at a given snapshot.
Parameters¶
- tsnapshot id (default=None)
If None the the method returns all the nodes of the flattened graph.
- databoolean, optional (default=False)
If False return a list of nodes. If True return a two-tuple of node and node data dictionary
Returns¶
- nlistlist
A list of nodes. If data=True a list of two-tuples containing (node, node data dictionary).
Examples¶
>>> import dynetx as dn >>> G = dn.DynDiGraph() # or DiGraph, MultiGraph, MultiDiGraph, etc >>> G.add_interaction(0, 1, 0) >>> G.nodes(t=0) [0, 1] >>> G.add_interaction(1, 4, t=1) >>> G.nodes(t=0) [0, 1]