Utility functions. preOrder and levelOrder transform Tree a to List a, where the nodes are listed in the given order. Given Tree a, the edges function returns List (a,a), where a pair (p,q) is in the returned list if and only if q is a child of p.
preOrder : Tree a -> List a
levelOrder : Tree a -> List a
edges : Tree a -> List ( a, a )
Return a list of pairs (x,y) where
- x and y are of type a
- (x,y) is in the list if and only if y is a chiild of x.