You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently only pre-order traversal is supported by the depthFirstSearch and breadthFirstSearch methods. Traversal should be updated to allow both pre and post order callbacks. Here's a proof-of-concept that got worked out during the initial filtering work. It would need to be updated to include filtering, which would be trivial.
// TODO incorporate this into regular traversal methodfunctiondepthFirstTraverseWithPostorder(nodeActionPreorderCallback,nodeActionPostorderCallback){if(treeModel.value.length===0){return;}letnodeQueue=treeModel.value.slice();letvisited=[];// OPTIMIZATION - Don't track this if no postorder callback is given (and also don't push current after preorder processing)while(nodeQueue.length>0){letcurrent=nodeQueue.shift();if(!visited.includes(current)){nodeActionPreorderCallback(current);visited.push(current);letchildrenPropName=current.treeNodeSpec.childrenProperty;nodeQueue=[...current[childrenPropName],current].concat(nodeQueue);}else{// this is either a leaf or a parent whose children have all been processednodeActionPostorderCallback(current);}}}
The text was updated successfully, but these errors were encountered:
Currently only pre-order traversal is supported by the depthFirstSearch and breadthFirstSearch methods. Traversal should be updated to allow both pre and post order callbacks. Here's a proof-of-concept that got worked out during the initial filtering work. It would need to be updated to include filtering, which would be trivial.
The text was updated successfully, but these errors were encountered: