Tangle#
- class tangles.Tangle(agreement: int, core: set[tuple[int, int]] | None = None, parent: Tangle | None = None)#
A node in the tangle search tree. It represents a tangle.
The path of the tangle search tree from the root to this node determines the features in this tangle: Each edge on the path determines the orientation of a separation.
More precisely, if the path contains an edge from a node on tree level \(k-1\) to a node on tree level \(k\) which is a left child, then this tangle contains the left orientation of the separation corresponding to tree level \(k\) (and vice versa for a right child).
Attributes#
- parentTangle or None
The parent in the tangle search tree. It is a tangle that orients every separation except for the highest order separation of this tangle. None if the tangle is the root tangle.
- left_childTangle or None
The left child in the tangle search tree. It is a tangle that orients one more separation than this tangle. The left child orients this additional separation to the left. None if there is no left child.
- right_childTangle or None
The right child in the tangle search tree. It is a tangle that orients one more separation than this tangle. The right child orients this additional separation to the right. None if there is no right child.
- coreset[OrientedSep]
The set of all minimal oriented separations contained within this tangle.
- agreementint
The agreement value of this tangle.
Methods
Return the list of children of this node
Create a new tangle with the same core and agreement value
Copy the subtree starting at this node
Replace each child by a copy of the subtree starting at this node
Detach the node by removing its pointer to its parent and the parents pointer to it
Check whether two tangles have the same data (core and agreement value)
Turn an indicator matrix back into a binary tree
Whether this node is a leaf
Find all leaves in the binary tree
Returns the level of this node
Return all the nodes at a certain depth below this node
Open the tangle by removing its children
Returns the list of sides one has to take to go from the root to this node
Set the left child of the node
Set the right child of the node
Turn a list of nodes into an indicator matrix