The Bipartition class
Class for representing bipartitions.
A bipartition is a partition of the set \(\{0, ..., 2n - 1\}\) for some non-negative integer \(n\); see the Semigroups package for GAP documentation for more details.
Contents
| Class for representing bipartitions. | |
| Copy a Bipartition object. | |
| Return the degree of the bipartition. | |
| Check if a block is a transverse block. | |
| Return an iterator yielding the indices of the blocks. | |
| Returns a copy of the left blocks of a bipartition. | |
| Returns the transverse blocks lookup. | |
| Return the number of blocks in a Bipartition. | |
| Return the number of blocks containing a positive integer. | |
| Return the number of blocks containing a negative integer. | |
| Return the identity bipartition of given degree. | |
| Return the number of transverse blocks. | |
| Returns a copy of the right blocks of a bipartition. | 
Full API
- class Bipartition
- __init__(*args, **kwargs)
- Overloaded function. - __init__(self: Bipartition, blocks: list[list[int]]) None
- Construct a bipartition from a partition. - The items in blocks should be: - duplicate-free; 
- pairwise disjoint; and 
- partition the set \(\{-n, \ldots, -1, 1, \ldots, n\}\) for some positive integer \(n\). 
 - Parameters:
- Raises:
- LibsemigroupsError – if any of the conditions above is not met. 
 
 - __init__(self: Bipartition, lookup: list[int]) None
- Construct a bipartition from a blocks lookup. - The parameter lookup: - is copied; 
- must have length \(2n\) for some positive integer \(n\); 
- consist of non-negative integers; and 
- have the property that if \(i\), \(i > 0\) occurs in lookup, then \(i - 1\) occurs earlier in lookup. The value of - blocks[i]should represent the index of the block containing- i.
 - For example, if lookup is - [0, 1, 1, 2, 1, 1, 3, 1, 1, 4, 5, 6], then the above conditions are satisfied, but if lookup is- [1, 0, 1, 10]then they are not.- Parameters:
- lookup (list[int]) – a lookup for the blocks of the bipartition being constructed. 
- Raises:
- LibsemigroupsError – if any of the conditions above is not met. 
 
 
 - copy(self: Bipartition) Bipartition
- Copy a Bipartition object. - Returns:
- A copy. 
- Return type:
 
 - degree(self: Bipartition) int
- Return the degree of the bipartition. - A bipartition is of degree \(n\) if it is a partition of \(\{0, \ldots, 2n - 1\}\). - Returns:
- The degree. 
- Return type:
 
 - is_transverse_block(self: Bipartition, index: int) bool
- Check if a block is a transverse block. - A block of a biparition is transverse if it contains integers less than and greater than \(n\), which is the degree of the bipartition. - Parameters:
- index (int) – the index of a block 
- Returns:
- Whether or not the given block is transverse. 
- Return type:
- Raises:
- LibsemigroupsError – if index is not in the range from - 0to- number_of_left_blocks.
- Complexity:
- At worst \(O(n)\) where \(n\) is the - degree().
 
 - iterator(self: Bipartition) collections.abc.Iterator[int]
- Return an iterator yielding the indices of the blocks. - Returns:
- An iterator yielding the indices of the blocks. 
- Return type:
- Complexity:
- Constant. 
 
 - left_blocks(self: Bipartition) Blocks
- Returns a copy of the left blocks of a bipartition. - The left blocks of a bipartition is the partition of \(\{0, \ldots, n - 1\}\) induced by the bipartition. This function returns a - Blocksobject representing this partition.
 - lookup(self: Bipartition) list[bool]
- Returns the transverse blocks lookup. The value in position - iof the returned list is- Trueif the block with index- iis transverse and- Falseif it is not transverse.
 - number_of_blocks(self: Bipartition) int
- Return the number of blocks in a Bipartition. This function returns the number of parts in the partition that instances of this class represent. 
 - number_of_left_blocks(self: Bipartition) int
- Return the number of blocks containing a positive integer. The left blocks of a bipartition is the partition of \(\{0, \ldots, n - 1\}\) induced by the bipartition. This member function returns the number of blocks in this partition. 
 - number_of_right_blocks(self: Bipartition) int
- Return the number of blocks containing a negative integer. The right blocks of a bipartition is the partition of \(\{n, \ldots, 2n - 1\}\) induced by the bipartition. This member function returns the number of blocks in this partition. 
 - static one(self: Bipartition, n: int) Bipartition
- Return the identity bipartition of given degree. - Returns the identity bipartition of degree - n. The identity bipartition of degree \(n\) has blocks \(\{i, -i\}\) for all \(i\in \{0, \ldots, n - 1\}\). This member function returns a new identity bipartition of degree equal to- n.- Parameters:
- n (int) – the degree of the identity to be returned. 
- Returns:
- A newly constructed - Bipartition.
- Return type:
 
 - rank(self: Bipartition) int
- Return the number of transverse blocks. The rank of a bipartition is the number of blocks containing both positive and negative values, which are referred to as the transverse blocks. 
 - right_blocks(self: Bipartition) Blocks
- Returns a copy of the right blocks of a bipartition. - The right blocks of a bipartition is the partition of \(\{0, \ldots, n - 1\}\) induced by the bipartition. This function returns a - Blocksobject representing this partition.