Closed hyanwong closed 3 days ago
Nothing wrong with recursion here if it makes things simpler - this bit isn't going to be perf sensitive so clarity wins.
Feel free to plug this in to infer_binary
in a PR and I'll try it out?
Nothing wrong with recursion here if it makes things simpler - this bit isn't going to be perf sensitive so clarity wins.
It we have just one huge tree to add, we could hit the recursion depth limit in python. Anyway, the stack approach works now, I think (there's some decent checking in there)
We've switched over to this - thanks for a great idea @hyanwong!
Here's some code for @szhan to look at. I reworked the re-rooting algorithm to use a stack, rather than recursion, but I'm not great at stack-based approaches, so I could have something wrong. We can probably take out some of the checks e.g. that the variation is identical.
Should we test this for speed on some of the larger inserted trees?