// •──┬─1 // ├─┬─2 // │ ├───3 Will be encoded as the list of pairs. Each pair encodes // │ ├───4 a single edge from child to parent. All parents will // │ └───5 be wrapped in an Option.some(). A single element will // ├─┬─6 appear in the list where the parent (target of the edge) // │ ├───7 will be Option.none(). The head element of this pair // │ ├───8 is the tree root node. // │ └─┬─11 // │ └───9 // └───10 consttree: Tree<number> = from(1, from(2, of(3), of(4), of(5)), from(6, of(7), of(8), from(11, of(9))), of(10), )
Encode the given tree as its edge list.