The Blocks class

A Blocks object represents a signed partition of the set \(\{0, \ldots, n - 1\}\).

It is possible to associate to every Bipartition a pair of blocks, Bipartition.left_blocks() and Bipartition.right_blocks(), which determine the Green’s \(\mathscr{L}\)- and \(\mathscr{R}\)-classes of the Bipartition in the monoid of all bipartitions. This is the purpose of this class.

See also Bipartition for more details and context.

Contents

Blocks

A Blocks object represents a signed partition of the set \(\{0, \ldots, n - 1\}\).

Blocks.copy(…)

Copy a Blocks object.

Blocks.degree(…)

Return the degree of a blocks object.

Blocks.is_transverse_block(…)

Check if a block is a transverse block.

Blocks.iterator(…)

Return a const iterator yielding the indices of the blocks.

Blocks.lookup(…)

Returns the transverse blocks lookup.

Blocks.number_of_blocks(…)

Return the number of blocks in a Blocks object.

Blocks.rank(…)

Return the number of transverse blocks.

Full API

class Blocks
__init__(self: Blocks, blocks: list[list[int]]) None

Constructs a Blocks object from a list of lists of integers.

This function constructs a Blocks object from a list of lists of integers, so that the blocks consisting of negative values are transverse and those consisting of positive values are not.

Parameters:

blocks (list[list[int]]) – the blocks

Raises:
Complexity:

linear in the sum of the sizes of the lists in blocks.

copy(self: Blocks) Blocks

Copy a Blocks object.

Returns:

A copy.

Return type:

Blocks

degree(self: Blocks) int

Return the degree of a blocks object. The degree of a Blocks object is the size of the set of which it is a partition, or the size of the blocks used to construct self.

Returns:

The degree of a Blocks object.

Return type:

int

is_transverse_block(self: Blocks, index: int) bool

Check if a block is a transverse block.

This function returns True if the block with index index is a transverse (or signed) block and it returns False if it is not transverse (or unsigned).

Parameters:

index (int) – the index of a block

Returns:

Whether or not the given block is transverse.

Return type:

bool

Raises:

LibsemigroupsError – if index is not in the range \([0, n)\) where \(n\) is the return value of number_of_blocks.

Complexity:

Constant.

iterator(self: Blocks) collections.abc.Iterator[int]

Return a const iterator yielding the indices of the blocks.

Returns:

An iterator yielding the indices of blocks.

Return type:

collections.abc.Iterator[int]

Complexity:

Constant.

lookup(self: Blocks) list[bool]

Returns the transverse blocks lookup.

This function returns the transverse blocks lookup. The value in position i of the returned list is True if the block with index i is transverse and False if it is not.

Returns:

The transverse block lookup list.

Return type:

list[bool]

Complexity:

Constant.

number_of_blocks(self: Blocks) int

Return the number of blocks in a Blocks object. This function returns the number of parts in the partition that instances of this class represent.

Returns:

The number of blocks.

Return type:

int

Complexity:

At worst \(O(n)\) where \(n\) is degree().

rank(self: Blocks) int

Return the number of transverse blocks. This function returns the number of True values in lookup().

Returns:

The number of signed (transverse) blocks in self.

Return type:

int

Complexity:

At most linear in the number of blocks.