Skip to content

Conversation

dpbutter
Copy link
Contributor

@dpbutter dpbutter commented Aug 6, 2025

Per our discussion last year, here is a better version of sort_sum that offloads the sorting into a new subroutine in tree.hh.

@kpeeters
Copy link
Owner

kpeeters commented Aug 7, 2025

What was the motivation to introduce a new sort_subtree into tree.hh, when there is already sort?

@kpeeters
Copy link
Owner

kpeeters commented Aug 7, 2025

For reference: the discussion referred to above is in PR #286.

@dpbutter
Copy link
Contributor Author

dpbutter commented Aug 7, 2025

The existing sort seems dependent on the compare_nodes class, which only compares on the data of the node in question (i.e. the root node of the subtree to be sorted). So without breaking the tree.hh API, it seemed I couldn't use the existing sort to accomplish this.

@kpeeters
Copy link
Owner

kpeeters commented Oct 9, 2025

I have just merged this into devel, sorry for the long wait.

@kpeeters kpeeters closed this Oct 9, 2025
@dpbutter
Copy link
Contributor Author

No worries. I was a bit worried about mucking with tree.hh, but it seemed the most natural solution.

@kpeeters
Copy link
Owner

No problem, I am actually surprised that when I wrote that, I thought that it would make sense to just compare data at the top node. Your solution makes much more sense.

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