summaryrefslogtreecommitdiff
path: root/networkx/classes/function.py
diff options
context:
space:
mode:
authorJeffrey Finkelstein <jeffrey.finkelstein@gmail.com>2015-05-20 22:43:28 -0400
committerMridul Seth <seth.mridul@gmail.com>2015-06-11 23:55:58 +0530
commit203295422d6f57ed4cb4c523057a4fa53e4485fc (patch)
tree821e591f3701106f5256775071a33d0021a6e29e /networkx/classes/function.py
parentd49733b61fb7dedfbbbdd9c04464adf6beb5db07 (diff)
downloadnetworkx-203295422d6f57ed4cb4c523057a4fa53e4485fc.tar.gz
Makes Graph.nodes() return iterator instead of list
Previously `Graph.nodes()` returned a list of nodes and `Graph.nodes_iter()` returned an iterator over nodes. With this commit, the former function now returns an iterator and the latter no longer exists.
Diffstat (limited to 'networkx/classes/function.py')
-rw-r--r--networkx/classes/function.py11
1 files changed, 3 insertions, 8 deletions
diff --git a/networkx/classes/function.py b/networkx/classes/function.py
index 4ae7d45e..7476578b 100644
--- a/networkx/classes/function.py
+++ b/networkx/classes/function.py
@@ -15,7 +15,7 @@ __author__ = """\n""".join(['Aric Hagberg (hagberg@lanl.gov)',
'Dan Schult(dschult@colgate.edu)'])
__all__ = ['nodes', 'edges', 'degree', 'degree_histogram', 'neighbors',
'number_of_nodes', 'number_of_edges', 'density',
- 'nodes_iter', 'edges_iter', 'is_directed','info',
+ 'edges_iter', 'is_directed','info',
'freeze','is_frozen','subgraph','create_empty_copy',
'set_node_attributes','get_node_attributes',
'set_edge_attributes','get_edge_attributes',
@@ -25,13 +25,8 @@ __all__ = ['nodes', 'edges', 'degree', 'degree_histogram', 'neighbors',
def nodes(G):
- """Return a copy of the graph nodes in a list."""
- return G.nodes()
-
-
-def nodes_iter(G):
"""Return an iterator over the graph nodes."""
- return G.nodes_iter()
+ return G.nodes()
def edges(G,nbunch=None):
@@ -495,7 +490,7 @@ def non_edges(graph):
Iterator of edges that are not in the graph.
"""
if graph.is_directed():
- for u in graph.nodes_iter():
+ for u in graph.nodes():
for v in non_neighbors(graph, u):
yield (u, v)
else: