phylox.rearrangement.movability
Functions
|
Checks whether an endpoint of an edge is movable in a network. |
|
Checks whether a move is valid. |
- phylox.rearrangement.movability.check_valid(network, move)
Checks whether a move is valid.
- Parameters:
move – a rearrangement move (see phylox.rearrangement.movetype.Move)
- Returns:
void
- Exception:
InvalidMoveException if the move is not valid
- Example:
>>> from phylox import DiNetwork >>> from phylox.rearrangement.move import Move >>> from phylox.rearrangement.movability import check_valid >>> network = DiNetwork( ... edges=[(0,1),(1,2),(1,3),(2,3),(2,4),(3,5)], ... ) >>> move = Move( ... move_type=MoveType.HEAD, ... origin=(2, 5), ... moving_edge=(1, 3), ... target=(2, 4), ... ) >>> check_valid(network, move)
- phylox.rearrangement.movability.check_movable(network, moving_edge, moving_endpoint)
Checks whether an endpoint of an edge is movable in a network.
- Parameters:
network – a phylogenetic network, i.e., a DAG with labeled leaves.
moving_edge – an edge in the network.
moving_endpoint – a node, specifically, an endpoint of the moving_edge.
- Returns:
True if the endpoint of the edge is movable in the network, False otherwise.
- Example:
>>> from phylox import DiNetwork >>> from phylox.rearrangement.movability import check_movable >>> network = DiNetwork( ... edges=[(0,1),(1,2),(1,3),(2,3),(2,4),(3,5)], ... ) >>> check_movable(network, (1, 3), 3) True >>> check_movable(network, (1, 3), 1) True >>> check_movable(network, (3, 5), 3) False