alifestd_find_pair_distance_asexual

alifestd_find_pair_distance_asexual(phylogeny_df: DataFrame, first: int, second: int, *, criterion: str = 'origin_time', mutate: bool = False) float | None

Find the pairwise distance between two taxa via their MRCA.

The distance is computed as the sum of criterion differences between each taxon and their Most Recent Common Ancestor (MRCA):

distance = (criterion[first] - criterion[mrca])
  • (criterion[second] - criterion[mrca])

Parameters

phylogeny_dfpd.DataFrame

Phylogeny in alife standard format.

firstint

First taxon id.

secondint

Second taxon id.

criterionstr, default “origin_time”

Column name used to measure distance between taxa and their MRCA.

mutatebool, default False

If True, allows in-place modification of phylogeny_df.

Returns

float or None

The pairwise distance between the two taxa, or None if they have no common ancestor.

See Also

alifestd_find_pair_mrca_id_asexual :

Finds the MRCA id used internally by this function.

alifestd_find_pair_distance_polars :

Polars-based implementation.