163. Rooted.try_from_parents builds a forest from parents that may be invalid (2026-11-21)
- Decision.
Rooted.from_parents(par)builds a forest when several keys have no parent (roots in key order) and traps on a cycle.Rooted.try_from_parents(par)returns?Rooted,Noneon a cycle. This follows the existingtry_convention (try_inv,try_fold,try_at): the plain form assumes valid input, and thetry_form is for input that may not be. - Why. egoi23p7 must answer NO when the required parent links contain a cycle. Its port
checked that by hand with a component pass, a top-per-component table and an
any. Its blind dream wrotelet Some(forest) = Rooted.from_parents(need) else: .... Any problem that gives "parent of each vertex" and allows invalid input needs this. Ryan approved the shape. - Reverse. Delete
try_from_parentsfromspec/std/tree.cp, restore the one-root wording offrom_parents, and restore thecomponentsversion ofcorpus/problems/egoi23p7/spec.cp.