Return a list of the nodes in the graph.
Parameters: | data : boolean, optional (default=False)
|
---|---|
Returns: | nlist : list
|
Examples
>>> G = nx.Graph() # or DiGraph, MultiGraph, MultiDiGraph, etc
>>> G.add_path([0,1,2])
>>> print G.nodes()
[0, 1, 2]
>>> G.add_node(1, time='5pm')
>>> print G.nodes(data=True)
[(0, {}), (1, {'time': '5pm'}), (2, {})]