Ticket #7380 (closed defect: worksforme)
Replace Graph.vertices() by Graph.vertex_iterator when possible
| Reported by: | ncohen | Owned by: | rlm |
|---|---|---|---|
| Priority: | major | Milestone: | sage-duplicate/invalid/wontfix |
| Component: | graph theory | Keywords: | |
| Cc: | Work issues: | ||
| Report Upstream: | N/A | Reviewers: | |
| Authors: | Merged in: | ||
| Dependencies: | Stopgaps: |
Description
As the title says, there are many places where Graph.vertices() is used when Graph.vertex_iterator ( or even self ) would be better. The same goes for edges.
Nathann
Change History
comment:1 Changed 3 years ago by ncohen
- Status changed from new to closed
- Report Upstream set to N/A
- Resolution set to wontfix
- Milestone changed from sage-4.3.4 to sage-duplicate/invalid/wontfix
comment:2 Changed 3 years ago by mvngu
Read this section before closing tickets. Can you explain why you want to close this ticket?
comment:3 follow-up: ↓ 4 Changed 3 years ago by ncohen
Well, as I created it I thought it would not be so bad to close it too ;
The thing is that I do not feel anymore that this should be done, or just useful in any way. It would just slow down most functions as creating an iterator has no real sense when the whole set is already stored in memory, and it would make the code harder to read for no real purpose :p
Nathann
comment:4 in reply to: ↑ 3 Changed 3 years ago by mvngu
Replying to ncohen:
Well, as I created it I thought it would not be so bad to close it too ;
As long as you provide a good reason to close the ticket. Don't just close a ticket without any good reasons.
comment:5 Changed 3 years ago by ylchapuy
Sorry for commenting a closed ticket, but...
If I look at the docstring for vertices I see (in the default case):
return sorted(list(self.vertex_iterator()))
A new list is created, doubling the memory needed, and this list is sorted which might take time too.
I still think it might make sense to replace vertices with vertex_iterator when possible.

Useless.