Closed GoogleCodeExporter closed 9 years ago
[deleted comment]
We already have iterators. Try:
for n in gr:
# iterates all nodes
for m in gr[n]:
# iterates all edges as (n, m) pairs
Original comment by pmatiello
on 24 Nov 2009 at 1:12
I'm closing this issue, Salim. If you have any objection, feel free to reopen
it.
Original comment by pmatiello
on 30 Nov 2009 at 8:15
Not going to re-open, however I think the problem is that the default method is
not
great for large graphs. G.nodes() and g.edges() are the main ways of accessing
every
member of the whole graph.
Returning a list is fine for len(G) < 1000, but once we start dealing with big
graphs
it's a pain. It's utterly horrible if the underlying storage for G is not in
memory -
you'd have to load in every record from an index or database to produce
g.nodes(),
even if you only wanted to do G.nodes()[:3] - IMO, this is an API design issue
which
limits the long-term usefulness of the classes which implement it.
In general, I feel we should try to return iterators where possible,
Original comment by salimfadhley@gmail.com
on 30 Nov 2009 at 8:23
@salim: Whats the issue with using the iterators as they are currently
accessible?
Original comment by christian.muise
on 1 Dec 2009 at 2:30
Original issue reported on code.google.com by
salimfadhley@gmail.com
on 24 Nov 2009 at 12:54