phylox.cherrypicking.tree_child_sequences.tree_child_network_contains

phylox.cherrypicking.tree_child_sequences.tree_child_network_contains(N, M, labels=False)

Check if a tree child network N contains another network M.

Parameters:
  • N (phylox.DiNetwork) – The network to check for containment.

  • M (phylox.DiNetwork) – The network to check for.

  • labels (bool) – Whether to return the tree child sequence as a list of labels instead of a list of nodes.

Returns:

True if N contains M, False otherwise.

Return type:

bool

Example:

>>> from phylox import DiNetwork
>>> N = DiNetwork(
...     edges=[(-1, 0), (0, 1), (0, 2), (1, 2), (1, 3), (2, 4)],
...     labels=[(3, "A"), (4, "B")],
... )
>>> M = DiNetwork(
...     edges=[(-1, 0), (0, 1), (0, 2)],
...     labels=[(1, "A"), (2, "B")],
... )
>>> tree_child_network_contains(N, M, labels=True)
True