Skip to content

fix return value for iterative layout - #105

Merged
hexaeder merged 2 commits into
masterfrom
hw/fix_iter
Sep 23, 2026
Merged

hexaeder merged 2 commits into
masterfrom
hw/fix_iter

Conversation

@hexaeder

@hexaeder hexaeder commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

previously, we returned the second to last entry in the iterator, whoops

Also fixes the iterations kw of the iterative layouts. There was a >= which should have been a >. iterations=1 should not mean to just return the initial positions, it should mean to iterate once on the initial positions. Therefore the iterator should return at max iterations+1 positions.

iterations now fixes number of iterations not including the initial positions
@hexaeder
hexaeder merged commit 14e59ef into master Sep 23, 2026
5 checks passed
@hexaeder hexaeder mentioned this pull request Sep 23, 2026
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)`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant