(id)
| 66 | } |
| 67 | |
| 68 | finalizeRootMap(id) { |
| 69 | let stack = [this]; |
| 70 | while (stack.length > 0) { |
| 71 | let current = stack.pop(); |
| 72 | if (current.leftId !== 0) { |
| 73 | console.warn('Skipping potential parent loop between maps:', current) |
| 74 | continue; |
| 75 | } |
| 76 | current.finalize(id); |
| 77 | id += 1; |
| 78 | current.children.forEach(edge => stack.push(edge.to)); |
| 79 | // TODO implement rightId |
| 80 | } |
| 81 | return id; |
| 82 | } |
| 83 | |
| 84 | finalize(id) { |
| 85 | // Initialize preorder tree traversal Ids for fast subtree inclusion checks |