List<NodeV3> get pathToRoot { List<NodeV3> result = []; var k = this; while (!k.isRoot) { result.add(k); k = k.parent!; } result.add(k); return result; }