Skip to content

Implement postorder iterator for nodes range.#688

Merged
tturocy merged 2 commits intomasterfrom
dev_nodes
Dec 15, 2025
Merged

Implement postorder iterator for nodes range.#688
tturocy merged 2 commits intomasterfrom
dev_nodes

Conversation

@tturocy
Copy link
Copy Markdown
Member

@tturocy tturocy commented Dec 10, 2025

This extends the Nodes range iterator to have two modes, preorder (the existing one), and
postorder (added).

These are runtime-selectable via the TraversalOrder parameter. The default is preorder (so existing code still works).

This extends the Nodes range iterator to have two modes,
preorder (the existing one), and
postorder (added).

These are runtime-selectable via the TraversalOrder parameter.
The default is preorder (so existing code still works).
@tturocy tturocy requested review from d-kad and rahulsavani December 10, 2025 21:12
@tturocy
Copy link
Copy Markdown
Member Author

tturocy commented Dec 10, 2025

@d-kad @rahulsavani As it turned out, as I was unpicking some matters in MixedBehaviorProfile to work on another issue, I realised that it would be a very good idea to implement postorder iteration on nodes there as well. So I have proposed an extension to the Nodes range which allows both preorder and postorder iteration. Tests pass so the refactored preorder seems to be correct. Postorder is not tested however.

Copy link
Copy Markdown
Contributor

@d-kad d-kad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To test it, I updated the game.h file in the current subgame root finder branch and replaced the suboptimal vector-reversal approach in FindSubgameRoots with a call to the new iterator. All tests in the subgames suite passed.

@tturocy
Copy link
Copy Markdown
Member Author

tturocy commented Dec 15, 2025

Absent directly having tests, I'm going to take that as good enough for present purposes!

@tturocy tturocy merged commit 0657cae into master Dec 15, 2025
28 checks passed
@tturocy tturocy deleted the dev_nodes branch December 15, 2025 09:20
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.

2 participants