LeftChildRightSiblingTrees.jl icon indicating copy to clipboard operation
LeftChildRightSiblingTrees.jl copied to clipboard

Insert Nodes as Children/Siblings

Open SBuercklin opened this issue 2 years ago • 0 comments

Right now, addchild and addsibling require you to pass the data directly. Is it reasonable to add methods which allow you to specify child::Node{T}s rather than data::T?

I'm working with a problem where the end product is conveniently represented as a LCRS tree, but it's most sensible to build it from the bottom up, rather than the top down. This means I want to pass a subtree as a child rather than just the data, because that node has a collection of children/siblings already. Presumably we could do this with making Node{T}s which duplicate data and then graftchildren! to this duplicate node, but it seems like we could this more directly

E- This runs into the issue where you could add a Node from a tree to the tree again somewhere else, so it's not necessarily safe. That might be enough to disqualify this

SBuercklin avatar Apr 06 '22 17:04 SBuercklin