Some fast computations for finite posets

class sage.combinat.posets.hasse_cython.IncreasingChains(positions, element_constructor, exclude, conversion=None)

Bases: RecursivelyEnumeratedSet_forest

The enumerated set of increasing chains.

INPUT:

  • positions – list of sets of integers describing the poset, as given by the lazy attribute _leq_storage of Hasse diagrams

  • element_constructor – used to determine the type of chains, for example list or tuple

  • exclude – list of integers that should not belong to the chains

  • conversion – (optional) list of elements of the poset

If conversion is provided, it is used to convert chain elements to elements of this list.

EXAMPLES:

sage: from sage.combinat.posets.hasse_cython import IncreasingChains
sage: D = IncreasingChains([{0,1},{1}], list, []); D
An enumerated set with a forest structure
sage: D.cardinality()
4
sage: list(D)
[[], [0], [0, 1], [1]]
>>> from sage.all import *
>>> from sage.combinat.posets.hasse_cython import IncreasingChains
>>> D = IncreasingChains([{Integer(0),Integer(1)},{Integer(1)}], list, []); D
An enumerated set with a forest structure
>>> D.cardinality()
4
>>> list(D)
[[], [0], [0, 1], [1]]
children(chain)

Return the children of a chain, by adding one largest element.

EXAMPLES:

sage: from sage.combinat.posets.hasse_cython import IncreasingChains
sage: D = IncreasingChains([{0,1},{1}], list, [])
sage: D.children((0,))
[(0, 1)]

sage: P = Poset({'a':['b'],'b':[]})
sage: next(iter(P.chains()))
[]
>>> from sage.all import *
>>> from sage.combinat.posets.hasse_cython import IncreasingChains
>>> D = IncreasingChains([{Integer(0),Integer(1)},{Integer(1)}], list, [])
>>> D.children((Integer(0),))
[(0, 1)]

>>> P = Poset({'a':['b'],'b':[]})
>>> next(iter(P.chains()))
[]
post_process(chain)

Create a chain from the internal object.

If conversion was provided, it first converts elements of the chain to elements of this list.

Then the given element_constructor is applied to the chain.

EXAMPLES:

sage: from sage.combinat.posets.hasse_cython import IncreasingChains
sage: D = IncreasingChains([{0,1},{1}], list, [])
sage: D.post_process((0,1))
[0, 1]

sage: P = Poset({'a':['b'],'b':[]})
sage: list(P.chains())
[[], ['a'], ['a', 'b'], ['b']]
>>> from sage.all import *
>>> from sage.combinat.posets.hasse_cython import IncreasingChains
>>> D = IncreasingChains([{Integer(0),Integer(1)},{Integer(1)}], list, [])
>>> D.post_process((Integer(0),Integer(1)))
[0, 1]

>>> P = Poset({'a':['b'],'b':[]})
>>> list(P.chains())
[[], ['a'], ['a', 'b'], ['b']]