fix return value for iterative layout - #105
Merged
Merged
Conversation
iterations now fixes number of iterations not including the initial positions
Merged
emfeltham
added a commit
to emfeltham/NetworkLayout.jl
that referenced
this pull request
Sep 28, 2026
`layout` used to return the second to last item of the iterator, so the `Egocentric` iterator emitted the converged layout twice to make sure the final one was the one returned. JuliaGraphs#105 fixed that bug, so the workaround can go: `iterate` now simply terminates once the `tseq` schedule is exhausted. The workaround was the only writer of `EgocentricState.finished`, so that field is removed too. The returned layout is unchanged; the iterator just yields one item fewer. Verified by comparing positions before and after across the plain, `maxdist`, `compress=<number>`, `compress=nothing`, 3d/Float32 and karate cases -- all bit-identical. Also adapts the iterator tests to the new `iterations` semantics from JuliaGraphs#105: a single-stage `tseq` with `iterations=l` and zero tolerances now yields exactly `l + 1` layouts, with `last(vec) == algo(adj_matrix)`. No `>=` to `>` change was needed in the layout itself, because the per-stage counter is incremented after each sweep and so already counted actual iterations. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
emfeltham
added a commit
to emfeltham/NetworkLayout.jl
that referenced
this pull request
Sep 28, 2026
`layout` used to return the second to last item of the iterator, so the `Egocentric` iterator emitted the converged layout twice to make sure the final one was the one returned. JuliaGraphs#105 fixed that bug, so the workaround can go: `iterate` now simply terminates once the `tseq` schedule is exhausted. The workaround was the only writer of `EgocentricState.finished`, so that field is removed too. The returned layout is unchanged; the iterator now yields one item fewer. Verified by comparing positions before and after across the plain, `maxdist`, `compress=<number>`, `compress=nothing`, 3d/Float32 and karate cases -- all bit-identical. Also adapts the iterator tests to the new `iterations` semantics from single-stage `tseq` with `iterations=l` and zero tolerances now yields exactly `l + 1` layouts, with `last(vec) == algo(adj_matrix)`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
previously, we returned the second to last entry in the iterator, whoops
Also fixes the
iterationskw of the iterative layouts. There was a>=which should have been a>.iterations=1should not mean to just return the initial positions, it should mean to iterate once on the initial positions. Therefore the iterator should return at maxiterations+1positions.