phylox.classes.dinetwork

Functions

is_binary(network)

Checks if the network is binary.

is_leaf_labeled_single_root_network(network)

Checks if the network is a leaf-labeled network with a single root.

is_orchard(network)

Checks if the network is an orchard.

is_stack_free(network)

Checks if the network is stack-free.

is_tree_based(network)

Checks if the network is tree-based.

is_tree_child(network)

Checks if the network is a tree-child network.

phylox.classes.dinetwork.is_binary(network)

Checks if the network is binary.

Parameters:

network – a phylogenetic network phylox.DiNetwork.

Returns:

true if the network is binary, false otherwise.

Example:

>>> from phylox import DiNetwork
>>> from phylox.classes.dinetwork import is_binary
>>> network = DiNetwork(
...     edges=[(0,1),(1,2),(1,3),(2,3),(2,4),(3,5)],
... )
>>> is_binary(network)
True
>>> network = DiNetwork(
...     edges=[(0,1),(1,2),(1,3),(1,4)],
... )
>>> is_binary(network)
False
phylox.classes.dinetwork.is_orchard(network)

Checks if the network is an orchard.

Parameters:

network – a phylogenetic network phylox.DiNetwork.

Returns:

true if the network is an orchard, false otherwise.

Example:

>>> from phylox import DiNetwork
>>> from phylox.classes.dinetwork import is_orchard
>>> network = DiNetwork(
...     edges=[(0,1),(1,2),(1,3),(2,3),(2,4),(3,5)],
... )
>>> is_orchard(network)
True
>>> network = DiNetwork(
...     edges=[(0,1),(1,2),(1,3),(2,4),(3,5),(2,5),(3,4),(4,6),(5,7)],
... )
>>> is_orchard(network)
False
phylox.classes.dinetwork.is_stack_free(network)

Checks if the network is stack-free.

Parameters:

network – a phylogenetic network phylox.DiNetwork.

Returns:

true if the network is stack-free, false otherwise.

Example:

>>> from phylox import DiNetwork
>>> from phylox.classes.dinetwork import is_stack_free
>>> network = DiNetwork(
...     edges=[(0,1),(1,2),(1,3),(2,4),(3,5),(2,5),(3,4),(4,6),(5,7)],
... )
>>> is_stack_free(network)
True
>>> network = DiNetwork(
...     edges=[(0,1),(1,2),(1,3),(2,3),(3,5),(2,4),(4,5),(4,6),(5,7)],
... )
>>> is_stack_free(network)
False
phylox.classes.dinetwork.is_tree_based(network)

Checks if the network is tree-based.

Parameters:

network – a phylogenetic network phylox.DiNetwork.

Returns:

true if the network is tree-based, false otherwise.

Example:

>>> from phylox import DiNetwork
>>> from phylox.classes.dinetwork import is_tree_based
>>> network = DiNetwork(
...     edges=[(0,1),(1,2),(1,3),(2,3),(2,4),(3,5)],
... )
>>> is_tree_based(network)
True
phylox.classes.dinetwork.is_tree_child(network)

Checks if the network is a tree-child network.

Parameters:

network – a phylogenetic network phylox.DiNetwork.

Returns:

true if the network is a tree-child network, false otherwise.

Example:

>>> from phylox import DiNetwork
>>> from phylox.classes.dinetwork import is_tree_child
>>> network = DiNetwork(
...     edges=[(0,1),(1,2),(1,3),(2,3),(2,4),(3,5)],
... )
>>> is_tree_child(network)
True
>>> network = DiNetwork(
...     edges=[(0,1),(1,2),(1,3),(2,4),(3,5),(2,5),(3,4),(4,6),(5,7)],
... )
>>> is_tree_child(network)
False
>>> network = DiNetwork(
...     edges=[(0,1),(1,2),(1,3),(2,3),(3,5),(2,4),(4,5),(4,6),(5,7)],
... )
>>> is_tree_child(network)
False
phylox.classes.dinetwork.is_leaf_labeled_single_root_network(network)

Checks if the network is a leaf-labeled network with a single root.

Parameters:

network – a phylogenetic network phylox.DiNetwork.

Returns:

a boolean value.

Example:

>>> from phylox import DiNetwork
>>> from phylox.classes.dinetwork import is_leaf_labeled_single_root_network
>>> network = DiNetwork(
...     edges=[(0,1),(1,2),(1,3),(2,3),(2,4),(3,5)],
...     labels=[(4, "A"), (5, "B")],
... )
>>> is_leaf_labeled_single_root_network(network)
True
>>> network = DiNetwork(
...     edges=[(0,1),(2,3)],
...     labels=[(1, "A"), (3, "B")],
... )
>>> is_leaf_labeled_single_root_network(network)
False
>>> network = DiNetwork(
...     edges=[(0,1),(1,2),(1,3)],
...     labels=[(3, "B")],
... )
>>> is_leaf_labeled_single_root_network(network)
False