PhyNetPy Documentation

Library for the Development and Use of Phylogenetic Network Methods

JointDissimilarity Module v0.7.0

The joint reticulation-and-tree dissimilarity of two rooted networks: a minimum-cost matching of reticulation tripartitions plus a dissimilarity of the reticulation-free remainders, under leaf, cluster, or Nakhleh structure comparison.

Author:
Mark Kessler
Last Edit:
10/29/26
Source:
JointDissimilarity.py

Constants

JOINT_KINDS = ('leaf', 'cluster', 'nakhleh')

JointDissimilarityResult

class JointDissimilarityResult

The result of :func:`joint_dissimilarity` under one instantiation.

Properties

m -> int property
Returns: int: ``max(r1, r2)``, the size of the padded matching.
D_joint -> float property
Returns: float: ``D_ret + 3 D_tree``, raw, in ``[0, 3(m + 1)]``.
D_ret_normalized -> float property
Returns: float: ``D_ret / 3m`` in ``[0, 1]``; 0 when both are trees.
D_joint_normalized -> float property
Returns: float: ``D_joint / 3(m + 1)`` in ``[0, 1]``.

Module Functions

joint_dissimilarity(net1: Network, net2: Network, kind: str = 'nakhleh') -> JointDissimilarityResult

The joint reticulation-and-tree dissimilarity of two rooted phylogenetic networks on the same taxon set (see the module docstring for the definition). Symmetric, 0 on identical networks, and a metric on the tripartition and remainder representations under each instantiation. Both networks must have one root, be acyclic, have labelled leaves with no label used twice, and give every reticulation exactly two distinct parents and one child. Internal-node labels and branch lengths are ignored.

Parameter Type Description
net1 Network First network.
net2 Network Second network.
kind str Structure dissimilarity: ``"leaf"`` (Jaccard of leaf sets), ``"cluster"`` (multiset hardwired clusters) or ``"nakhleh"`` (vertex-equivalence classes; the default).
Returns: JointDissimilarityResult: ``r1``, ``r2``, ``D_ret`` and ``D_tree``, with ``m``, ``D_joint`` and the normalised forms as properties.
Raises: ValueError: If ``kind`` is not one of :data:`JOINT_KINDS`., NetworkError: If either network violates the requirements above, or the two taxon sets differ.

Navigation

Modules

This Page