phylox.networkproperties.murepresentation.add_unlabeled_mu_vectors_as_attribute

phylox.networkproperties.murepresentation.add_unlabeled_mu_vectors_as_attribute(network)

The unlabeled mu-vectors are added as a tuple(int, …, int) consisting of num_path values. For each labeled node, the num_paths value belonging to their label is set to one. Then, starting with the leaves and going up, the number of paths to each labeled node is calculated for all of the nodes, by adding the mu-vector of its children to that of itself.

The mu-vector entries are each sorted, as labels must be ignored after computing the vectors.

The resulting vectors are stored in the node attr MUVECTOR_UNLABELED_ATTR and the network is modified in place.

Parameters:

network – a DiNetwork

Example:

>>> from phylox import DiNetwork
>>> from phylox.networkproperties.murepresentation import add_unlabeled_mu_vectors_as_attribute
>>> network = DiNetwork.from_newick("((A,B),C);")
>>> add_unlabeled_mu_vectors_as_attribute(network)
>>> network.nodes[network.labels["A"][0]].get(MUVECTOR_UNLABELED_ATTR)
(0, 0, 1)
>>> network.nodes[network.labels["B"][0]].get(MUVECTOR_UNLABELED_ATTR)
(0, 0, 1)
>>> network.nodes[network.labels["C"][0]].get(MUVECTOR_UNLABELED_ATTR)
(0, 0, 1)