Pruning and Grafting
Here we demonstrate pruning and grafting of nodes usig the .addChild()
and .removeChild()
methods on the Node
class. In effect, these can be used to add or remove clades and tips.
As a general note, using the .copy()
method produces a deep copy of a node, and so is useful to avoid recursion issues, especially with iterative grafting.
See the Pen prune-graft by Leo Featherstone (@LeoFeatherstone) on CodePen.