Library for the Development and Use of Phylogenetic Network Methods
Strategy pattern interface for node-level computations dispatched during bottom-up traversal.
Abstract base for model-node computation strategies. Subclasses must implement one method per node kind. The ``ModelNode`` dispatch layer calls the matching method automatically during traversal.
Compute the strategy's quantity at a leaf node.
| Parameter | Type | Description |
|---|---|---|
| n | ModelNode | The leaf node currently being visited. |
Compute the strategy's quantity at an internal (non-root, non-leaf) node. Implementations may assume that ``compute_at_*`` has already been called for every child of ``n``.
| Parameter | Type | Description |
|---|---|---|
| n | ModelNode | The internal node currently being visited. |
Compute the strategy's quantity at a reticulation (hybrid) node. Reticulation nodes have two or more parents and a single child; the strategy is responsible for combining the contributions from each incoming branch (e.g. via the inheritance probabilities).
| Parameter | Type | Description |
|---|---|---|
| n | ModelNode | The reticulation node currently being visited. |
Compute the strategy's quantity at the root node. This is the terminal step of a bottom-up traversal; the return value (stored on the node by the implementation) typically represents the whole-network result, e.g. the marginal likelihood.
| Parameter | Type | Description |
|---|---|---|
| n | ModelNode | The root node currently being visited. |