phylox.rearrangement.invertsequence.from_edge

phylox.rearrangement.invertsequence.from_edge(network, moving_edge, moving_endpoint)

Finds the original location (from-edge) of the moving_endpoint of an edge if it is moved.

Parameters:
  • network – a phylogenetic network.

  • moving_edge – an edge of the network.

  • moving_endpoint – a node of the network, which must be an endpoint of the edge.

Returns:

a pair of nodes (p,c) where p and c are a parent and child of the moving_endpoint such that they are both not part of the moving_edge.

Example:

>>> from phylox import DiNetwork
>>> from phylox.rearrangement.invertsequence import from_edge
>>> network = DiNetwork(
...     edges=[(0,1),(1,2),(1,3)],
... )
>>> from_edge(network, (1,2), 1)
(0, 3)