|
|
|
|
|
by pokemyiout
336 days ago
|
|
Is there a typo in the induction section? Should `simplifyTree` and `simplifyGraph` be the same function? function simplifyTree(root: Node): Node { let newChildren = [] as Array<Node>;
for (const child of root.children) {
const simplifiedChild = simplifyGraph(child);
if (shouldContract(simplifiedChild)) {
for (const grandChild of simplifiedChild.children) {
newChildren.push(grandChild);
}
} else {
newChildren.push(simplifiedChild);
}
}
root.children = newChildren;
return root;
}
|
|