effect-tree
    Preparing search index...
    • Convert a tree with an order to its prüfer code.

      Tree requirements:

      1. It is a branch and not a leaf. I.E: at least two nodes.
      2. Root node value is minimum of all tree values. For example a tree of naturals should have the number 1 as its root node.

      We call filterMinLeaf and get back:

      1. Our tree with its minimal leaf removed
      2. The parent of this removed leaf, or none if root

      If the node has a parent, we add it to the left of the accumulated prüfer code array and recurse again on the now smaller tree.

      When a node has no parent, we stop the recursion.

      Type Parameters

      • A

      Parameters

      • order: Order<A>

      Returns (self: Branch<A>) => A[]