dynetx.classes.function.nodes¶
-
dynetx.classes.function.
nodes
(G, t=None)¶ Return a list of the nodes in the graph at a given snapshot.
Parameters: - G (Graph opject) – DyNetx graph object
- t (snapshot id (default=None)) – If None the the method returns all the nodes of the flattened graph.
Returns: nlist – A list of nodes. If data=True a list of two-tuples containing (node, node data dictionary).
Return type: list
Examples
>>> import dynetx as dn >>> G = dn.DynGraph() # or DiGraph, MultiGraph, MultiDiGraph, etc >>> G.add_path([0,1,2], 0) >>> dn.nodes(G, t=0) [0, 1, 2] >>> G.add_edge(1, 4, t=1) >>> dn.nodes(G, t=0) [0, 1, 2]