Skip to content

Reset stale node solution values in NearestNeighborsSolver#311

Merged
JoOkuma merged 1 commit into
royerlab:mainfrom
JoOkuma:fix-nn-solver-node-reset
Jul 1, 2026
Merged

Reset stale node solution values in NearestNeighborsSolver#311
JoOkuma merged 1 commit into
royerlab:mainfrom
JoOkuma:fix-nn-solver-node-reset

Conversation

@JoOkuma

@JoOkuma JoOkuma commented Jul 1, 2026

Copy link
Copy Markdown
Member

Re-solving a graph with reset=True only reset edge solution values; nodes dropped from the new solution kept solution=True, leaking stale nodes into the solution subgraph.

Reset node values to False when the output key already exists, mirroring the edge path and ILPSolver.

Added a regression test re-solving with a tighter max_children.

When re-solving a graph whose nodes already carried the solution
attribute, NearestNeighborsSolver only reset the edge values and left
node values from the previous solve untouched. Nodes dropped from the
new solution kept solution=True, so the returned solution subgraph
contained stale nodes.

Mirror the edge path (and ILPSolver) by resetting node values to False
when reset=True and the output key already exists.
@JoOkuma JoOkuma merged commit fd13ba4 into royerlab:main Jul 1, 2026
7 checks passed
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