-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Kruskal traversal iterator #336
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: kylebeggs <beggskw@gmail.com>
mutable struct KruskalIteratorState <: AbstractIteratorState | ||
edge_id::Int | ||
mst_len::Int | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the advantage of having a mutable iterator state here? Couldn't we simply return a new state?
end | ||
end | ||
|
||
Base.length(t::KruskalIterator) = nv(t.graph)-1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that true in case the graph is not connected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you are completely correct, but I don't have time to work on this at the moment, instead I would be willing to finish up #163, if you happen to have some review time I think it could be better to redirect it there :-)
(by the way I think also the other PR suffer from the same problem)
To be honest, I am not sure if an iterator is of much use here. We seem to do most of the allocations when create the iterator and we also do not seem to free any memory after each iteration. But perhaps I am wrong here. |
part of #163, to be revisited after that pr is merged