phylox.networkproperties.properties
Functions
|
returns the B_2 balance of the network |
|
finds a list of all blobs of the network and their properties. |
|
finds the number of reducible pairs in the network split up by number of cherries and number of reticulated cherries. |
|
returns the level of the network |
- phylox.networkproperties.properties.count_reducible_pairs(network)
finds the number of reducible pairs in the network split up by number of cherries and number of reticulated cherries.
- Parameters:
network – a phylogenetic network.
- Returns:
a dictionary with the number of reducible pairs in the network keys are “cherries” and “reticulate_cherries”
- Example:
>>> from phylox import DiNetwork >>> from phylox.networkproperties.properties import count_reducible_pairs >>> network = DiNetwork( ... edges=[(-1,0),(0,1),(1,2),(1,3),(2,3),(2,4),(3,5),(0,6),(6,7),(6,8)], ... ) >>> counts = count_reducible_pairs(network) >>> counts["cherries"] == 1 and counts["reticulate_cherries"] == 1 True
- phylox.networkproperties.properties.blob_properties(network)
finds a list of all blobs of the network and their properties. Each blob is a pair (blob_size, blob_level) where blob_size is the number of nodes in the blob and blob_level is the number of reticulations in the blob.
- Parameters:
network – a phylogenetic network.
- Returns:
a list of pairs (blob_size, blob_level)
- Example:
>>> from phylox import DiNetwork >>> from phylox.networkproperties.properties import blob_properties >>> network = DiNetwork( ... edges=[(1,2),(2,3),(2,4),(3,4),(3,5),(4,6),(6,7),(6,8),(7,8),(7,9),(8,10)], ... ) >>> blob_properties(network) [(3, 1), (3, 1)]
>>> network = DiNetwork( ... edges=[(0,1),(1,2),(1,3),(2,4),(3,5),(2,5),(3,4),(4,6),(5,7)], ... ) >>> blob_properties(network) [(5, 2)]
- phylox.networkproperties.properties.level(network)
returns the level of the network
- Parameters:
network – a phylogenetic network.
- Returns:
the level of the network
- Example:
>>> from phylox import DiNetwork >>> from phylox.networkproperties.properties import level >>> network = DiNetwork( ... edges=[(1,2),(2,3),(2,4),(3,4),(3,5),(4,6),(6,7),(6,8),(7,8),(7,9),(8,10)], ... ) >>> level(network) 1
>>> network = DiNetwork( ... edges=[(0,1),(1,2),(1,3),(2,4),(3,5),(2,5),(3,4),(4,6),(5,7)], ... ) >>> level(network) 2
- phylox.networkproperties.properties.b2_balance(network, connect_roots=False)
returns the B_2 balance of the network
- Parameters:
network – a phylogenetic network.
connect_roots – if True, connects all roots to a new root.
- Returns:
the B_2 balance of the network
- Example:
>>> from phylox import DiNetwork >>> from phylox.networkproperties.properties import b2_balance >>> network = DiNetwork( ... edges=[(0, 1), (1, 2), (1, 3), (2, 4), (2, 5), (3, 6), (3, 7)], ... ) >>> b2_balance(network) == 2 True