Bipartition helpers
This page contains the documentation for various helper functions for manipulating bipartitions.
This page contains the documentation for the bipartition subpackage, that
contains helper functions for the Bipartition class.
- bipartition.one(f: Bipartition) Bipartition
Return the identity bipartition with the same degree as the given bipartition.
The identity bipartition of degree \(n\) has blocks \(\{i, -i\}\) for all \(i\in \{0, \ldots, n - 1\}\). This function returns a new identity bipartition of degree equal to the degree of self.
- Parameters:
f (Bipartition) – a bipartition
- Returns:
A newly constructed
Bipartition.- Return type:
- bipartition.random(deg: int) Bipartition
Overloaded function.
- bipartition.random(x: Bipartition) None
Replace the contents of a bipartition with a random bipartition.
This function replaces the contents of the bipartition x with a random bipartition of degree equal to that of x, chosen at random from among all bipartitions of degree equal to x. If the degree of x is small enough for
bipartition.uniform_randomto run successfully, then the distribution is uniform, otherwise, the distribution is not uniform.- Parameters:
x (Bipartition) – the bipartition.
- bipartition.random(deg: int) Bipartition
Returns a random bipartition of specified degree.
This function returns a random bipartition of degree deg, chosen at random from among all bipartitions of degree equal to deg. If the degree deg is small enough for
bipartition.uniform_randomto run successfully, then the distribution is uniform, otherwise, the distribution is not uniform.- Parameters:
deg (int) – the degree of the returned bipartition.
- Returns:
A random
Bipartition.- Return type:
- bipartition.underlying_partition(f: Bipartition) list[list[int]]
Return the underlying partition of a
Bipartitionobject. The underlying partition of a bipartition f is the partition of a subset \(P\) of \(\{-n, \ldots, -1\}\cup \{1, \ldots, n\}\) such that:\(\{|y|\mid y\in P\} = \{1, \ldots, n\}\) ;
a block of the partition consists of negative numbers if and only if the corresponding block of y is a transverse block.
- Parameters:
f (Bipartition) – the bipartition
- Returns:
The underlying partition of the
Bipartition.- Return type:
- Complexity:
\(O(n)\) where \(n\) is the degree().
- bipartition.uniform_random(deg: int) Bipartition
Overloaded function.
- bipartition.uniform_random(x: Bipartition) None
Replace the contents of a bipartition with a random bipartition.
This function replaces the contents of the bipartition x with a random bipartition chosen uniformly at random from among all bipartitions of degree equal to that of x.
- Parameters:
x (Bipartition) – the bipartition.
- Raises:
LibsemigroupsError – if the degree of x is too large. The implementation depends on computing several values that can easily exceed the maximum value of any fixed precision integer or float type. When this occurs this exception is thrown.
- bipartition.uniform_random(deg: int) Bipartition
Returns a random bipartition of specified degree.
This function returns a random bipartition of degree deg, chosen uniformly at random from among all bipartitions of degree equal to deg.
- Parameters:
deg (int) – the degree of the returned bipartition.
- Returns:
A random
Bipartition.- Return type:
- Raises:
LibsemigroupsError – if the degree of deg is too large. The implementation depends on computing several values that can easily exceed the maximum value of any fixed precision integer or float type. When this occurs this exception is thrown.