Implement Kruskal traversal iterator#336
Implement Kruskal traversal iterator#336ameligrana wants to merge 1 commit intoJuliaGraphs:masterfrom
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.
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.
Is that true in case the graph is not connected?
There was a problem hiding this comment.
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