Skip to content

Implement Kruskal traversal iterator#336

Draft
ameligrana wants to merge 2 commits intoJuliaGraphs:masterfrom
ameligrana:patch-2
Draft

Implement Kruskal traversal iterator#336
ameligrana wants to merge 2 commits intoJuliaGraphs:masterfrom
ameligrana:patch-2

Conversation

@ameligrana
Copy link
Contributor

part of #163, to be revisited after that pr is merged

Co-authored-by: kylebeggs <beggskw@gmail.com>
Comment on lines +30 to +33
mutable struct KruskalIteratorState <: AbstractIteratorState
edge_id::Int
mst_len::Int
end
Copy link
Member

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
Copy link
Member

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?

Copy link
Contributor Author

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)

@simonschoelly
Copy link
Member

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.

@gdalle gdalle added the enhancement New feature or request label Mar 5, 2024
@Krastanov
Copy link
Member

This has stalled since the last round of review. For now I will mark it as a draft, to keep my review queue a bit more organized, but do not hesitate to convert it to not a draft if you have the energy to continue this submission.

@Krastanov Krastanov marked this pull request as draft February 21, 2026 05:52
@Krastanov
Copy link
Member

forgot to note: this would also need to be tested for correctness against the related existing code

@codecov
Copy link

codecov bot commented Feb 21, 2026

Codecov Report

❌ Patch coverage is 0% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.94%. Comparing base (5eaa071) to head (3ab5527).

Files with missing lines Patch % Lines
src/iterators/kruskal.jl 0.00% 21 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #336      +/-   ##
==========================================
- Coverage   97.22%   96.94%   -0.29%     
==========================================
  Files         122      123       +1     
  Lines        7240     7261      +21     
==========================================
  Hits         7039     7039              
- Misses        201      222      +21     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants