effect-tree - v1.0.36
    Preparing search index...

    Function getPruferEncodableArbitrary

    • A tree that can be encoded to a prüfer code has several requirements:

      1. Root node value = 1.
      2. For each number in the inclusive range 2…nodeCount there exists a single non-root node with that value.
      3. If you want round-trip encode/decode, make sure the branches are sorted. These six trees, for example, have the same prüfer code of 1, 1:
        •─┬─1  •─┬─1   •─┬─1   •─┬─1   •─┬─1   •─┬─1
          ├──2   ├──2    ├──3    ├──3    ├──4    ├──4
          ├──3   ├──4    ├──2    ├──4    ├──2    ├──3
          └──4   └──3    └──4    └──2    └──3    └──2
        ┈┈┈┈┈┈ ┈┈┈┈┈┈  ┈┈┈┈┈┈  ┈┈┈┈┈┈  ┈┈┈┈┈┈  ┈┈┈┈┈┈
          I      II     III      IV       V      VI
      

      Parameters

      • OptionalnodeCount: number

      Returns Arbitrary<Branch<number>>