PhyNetPy Documentation

Library for the Development and Use of Phylogenetic Network Methods

Strategy Module v0.3.0

Strategy pattern interface for node-level computations dispatched during bottom-up traversal.

Author:
Mark Kessler
Last Edit:
5/12/26
Source:
Strategy.py

Contents

Strategy

class Strategy(ABC)

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.

Methods

compute_at_leaf(n: ModelNode) -> None abstract

Compute the strategy's quantity at a leaf node.

Parameter Type Description
n ModelNode The leaf node currently being visited.
compute_at_internal(n: ModelNode) -> None abstract

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_at_reticulation(n: ModelNode) -> None abstract

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_at_root(n: ModelNode) -> None abstract

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.

Navigation

Modules

This Page