phylox.dinetwork.suppress_node
- phylox.dinetwork.suppress_node(network, node)
Suppresses a degree-2 node node and returns true if successful. The new arc has length length(p,node)+length(node,c). Returns false if node is not a degree-2 node.
- Parameters:
network (phylox.DiNetwork) – The network to suppress a node in.
node (str or int) – The node to suppress.
- Returns:
True if the node was suppressed, False otherwise.
- Return type:
bool
Examples
>>> from phylox import DiNetwork >>> network = DiNetwork() >>> network.add_edges_from([(0, 1, {'length': 1}), (1, 2, {'length': 1})]) >>> suppress_node(network, 1) True >>> network.edges(data=True) OutEdgeDataView([(0, 2, {'length': 2})])