PeelBackConjoinedLeavesTriePostprocessor

class PeelBackConjoinedLeavesTriePostprocessor[source]

Functor to separate any TrieLeafNode instances that are direct siblings.

Corrects for guaranteed-spurious differentia collisions among most-recent strata.

__init__()

Methods

__call__(trie: ~hstrat.phylogenetic_inference.tree._impl._TrieInnerNode.TrieInnerNode, p_differentia_collision: float, mutate: bool = False, progress_wrap: ~typing.Callable = <function PeelBackConjoinedLeavesTriePostprocessor.<lambda>>) TrieInnerNode[source]

Peel apart any TrieLeafNode nodes that are direct siblings.

Without reproduction dynamics that allow columns to be cloned without stratum deposit, two hereditary stratigraphic columns can only share their most-recent strata by collision.

Clones the sibling leaves’ parent node and attaches it to the the siblings’ grandparent node. One sibling node is then grafted away from its original parent and attached onto the newly cloned parent node as a child. The original parent node is left in place with any remaining children. This process is repeated until no TrieLeafNode’s remain as direct siblings.

Parameters:

trieTrieInnerNode

The root node of the trie to be unzipped.

p_differentia_collisionfloat

The multiplicative inverse of the number of possible differentia.

This fraction of possible rollbacks are performed.

mutatebool, default False

Are side effects on the input argument trie allowed?

progress_wraptyping.Callable, optional

Pass tqdm or equivalent to report progress.

Returns

TrieInnerNode

The postprocessed trie.