phylox.isomorphism.base.is_isomorphic
- phylox.isomorphism.base.is_isomorphic(network1, network2, partial_isomorphism=None, ignore_labels=False)
Determines whether two networks are labeled isomorphic.
- Parameters:
network1 – a phylogenetic network, i.e., a DAG with leaf labels stored as the node attribute LABEL_ATTR.
network2 – a phylogenetic network, i.e., a DAG with leaf labels stored as the node attribute LABEL_ATTR.
- Returns:
True if the networks are labeled isomorphic, False otherwise.
- Example:
>>> from phylox import DiNetwork >>> from phylox.isomorphism.base import is_isomorphic >>> network1 = DiNetwork( ... edges=[(0,1),(1,2),(1,3),(2,3),(2,4),(3,5)], ... labels=[(4, "A"), (5, "B")], ... ) >>> network2 = DiNetwork( ... edges=[(0,1),(1,2),(1,3),(2,3),(2,5),(3,6)], ... labels=[(5, "B"), (6, "A")], ... ) >>> is_isomorphic(network1, network2, ignore_labels=True) True >>> is_isomorphic(network1, network2, ignore_labels=False) False >>> is_isomorphic(network1, network2, partial_isomorphism=[(4,6)], ignore_labels=True) False