Some examples of posets and lattices.

sage.combinat.posets.poset_examples.AntichainPoset(*args, **kwds)

This function is deprecated and will be removed in a future version of Sage. Please use Posets.AntichainPoset instead.

TESTS::
sage: AntichainPoset(3) doctest:1: DeprecationWarning: AntichainPoset is deprecated, use Posets.AntichainPoset instead! Finite poset containing 3 elements
sage.combinat.posets.poset_examples.BooleanLattice(*args, **kwds)

This function is deprecated and will be removed in a future version of Sage. Please use Posets.BooleanLattice instead.

TESTS::
sage: BooleanLattice(3) doctest:1: DeprecationWarning: BooleanLattice is deprecated, use Posets.BooleanLattice instead! Finite lattice containing 8 elements
sage.combinat.posets.poset_examples.ChainPoset(*args, **kwds)

This function is deprecated and will be removed in a future version of Sage. Please use Posets.ChainPoset instead.

TESTS::
sage: ChainPoset(3) doctest:1: DeprecationWarning: ChainPoset is deprecated, use Posets.ChainPoset instead! Finite lattice containing 3 elements
sage.combinat.posets.poset_examples.DiamondPoset(*args, **kwds)

This function is deprecated and will be removed in a future version of Sage. Please use Posets.DiamondPoset instead.

TESTS::
sage: DiamondPoset(3) doctest:1: DeprecationWarning: DiamondPoset is deprecated, use Posets.DiamondPoset instead! Finite lattice containing 3 elements
sage.combinat.posets.poset_examples.PentagonPoset(*args, **kwds)

This function is deprecated and will be removed in a future version of Sage. Please use Posets.PentagonPoset instead.

TESTS::
sage: PentagonPoset() doctest:1: DeprecationWarning: PentagonPoset is deprecated, use Posets.PentagonPoset instead! Finite lattice containing 5 elements
sage.combinat.posets.poset_examples.PosetOfIntegerCompositions(*args, **kwds)

This function is deprecated and will be removed in a future version of Sage. Please use Posets.IntegerCompositions instead.

TESTS::
sage: PosetOfIntegerCompositions(3) doctest:1: DeprecationWarning: PosetOfIntegerCompositions is deprecated, use Posets.IntegerCompositions instead! Finite poset containing 4 elements
sage.combinat.posets.poset_examples.PosetOfIntegerPartitions(*args, **kwds)

This function is deprecated and will be removed in a future version of Sage. Please use Posets.IntegerPartitions instead.

TESTS::
sage: PosetOfIntegerPartitions(3) doctest:1: DeprecationWarning: PosetOfIntegerPartitions is deprecated, use Posets.IntegerPartitions instead! Finite poset containing 3 elements
sage.combinat.posets.poset_examples.PosetOfRestrictedIntegerPartitions(*args, **kwds)

This function is deprecated and will be removed in a future version of Sage. Please use Posets.RestrictedIntegerPartitions instead.

TESTS::
sage: PosetOfRestrictedIntegerPartitions(3) doctest:1: DeprecationWarning: PosetOfRestrictedIntegerPartitions is deprecated, use Posets.RestrictedIntegerPartitions instead! Finite poset containing 3 elements
class sage.combinat.posets.poset_examples.PosetsGenerator

Bases: object

A collection of examples of posets.

EXAMPLES::
sage: P = Posets() sage: P == loads(dumps(P)) True
AntichainPoset(n)

Returns an antichain (a poset with no comparable elements) containing n elements.

EXAMPLES:

sage: A = Posets.AntichainPoset(6); A
Finite poset containing 6 elements
sage: for i in range(5):
...       for j in range(5):
...           if A.covers(A(i),A(j)):
...              print "TEST FAILED"

TESTS:

Check that #8422 is solved:

sage: Posets.AntichainPoset(0)
Finite poset containing 0 elements
sage: C = Posets.AntichainPoset(1); C
Finite poset containing 1 elements
sage: C.cover_relations()
[]
sage: C = Posets.AntichainPoset(2); C
Finite poset containing 2 elements
sage: C.cover_relations()
[]
BooleanLattice(n)

Returns the Boolean lattice containing 2^n elements.

EXAMPLES:

sage: Posets.BooleanLattice(5)
Finite lattice containing 32 elements
ChainPoset(n)

Returns a chain (a totally ordered poset) containing n elements.

EXAMPLES:

sage: C = Posets.ChainPoset(6); C
Finite lattice containing 6 elements
sage: C.linear_extension() 
[0, 1, 2, 3, 4, 5]
sage: for i in range(5):
...       for j in range(5):
...           if C.covers(C(i),C(j)) and j != i+1:
...              print "TEST FAILED"

TESTS:

Check that #8422 is solved:

sage: Posets.ChainPoset(0)
Finite lattice containing 0 elements
sage: C = Posets.ChainPoset(1); C
Finite lattice containing 1 elements
sage: C.cover_relations()
[]
sage: C = Posets.ChainPoset(2); C
Finite lattice containing 2 elements
sage: C.cover_relations()
[[0, 1]]
DiamondPoset(n)

Returns the lattice of rank two containing n elements.

EXAMPLES:

sage: Posets.DiamondPoset(7)
Finite lattice containing 7 elements
IntegerCompositions(n)

Returns the poset of integer compositions of the integer n.

A composition of a positive integer n is a list of positive integers that sum to n. The order is reverse refinement: [p_1,p_2,...,p_l] < [q_1,q_2,...,q_m] if q consists of an integer composition of p_1, followed by an integer composition of p_2, and so on.

EXAMPLES:

sage: P = Posets.IntegerCompositions(7); P
Finite poset containing 64 elements
sage: len(P.cover_relations())
192
IntegerPartitions(n)

Returns the poset of integer partitions on the integer n.

A partition of a positive integer n is a non-increasing list of positive integers that sum to n. If p and q are integer partitions of n, then p covers q if and only if q is obtained from p by joining two parts of p (and sorting, if necessary).

EXAMPLES:

sage: P = Posets.IntegerPartitions(7); P
Finite poset containing 15 elements
sage: len(P.cover_relations())
28
PentagonPoset()

Return the “pentagon”.

EXAMPLES:

sage: Posets.PentagonPoset()
Finite lattice containing 5 elements
RandomPoset(n, p)

Generate a random poset on n vertices according to a probability distribution p.

EXAMPLES:

sage: Posets.RandomPoset(17,.15)
Finite poset containing 17 elements
RestrictedIntegerPartitions(n)

Returns the poset of integer partitions on the integer n ordered by restricted refinement. That is, if p and q are integer partitions of n, then p covers q if and only if q is obtained from p by joining two distinct parts of p (and sorting, if necessary).

EXAMPLES:

sage: P = Posets.RestrictedIntegerPartitions(7); P
Finite poset containing 15 elements
sage: len(P.cover_relations())
17
SymmetricGroupBruhatIntervalPoset(start, end)

The poset of permutations with respect to Bruhat order.

INPUT:

  • start - list permutation
  • end - list permutation (same n, of course)

Note

Must have start <= end.

EXAMPLES:

Any interval is rank symmetric if and only if it avoids these permutations:

sage: P1 = Posets.SymmetricGroupBruhatIntervalPoset([0,1,2,3], [2,3,0,1])
sage: P2 = Posets.SymmetricGroupBruhatIntervalPoset([0,1,2,3], [3,1,2,0])
sage: ranks1 = [P1.rank(v) for v in P1]
sage: ranks2 = [P2.rank(v) for v in P2]
sage: [ranks1.count(i) for i in uniq(ranks1)]
[1, 3, 5, 4, 1]
sage: [ranks2.count(i) for i in uniq(ranks2)]
[1, 3, 5, 6, 4, 1]
SymmetricGroupBruhatOrderPoset(n)

The poset of permutations with respect to Bruhat order.

EXAMPLES:

sage: Posets.SymmetricGroupBruhatOrderPoset(4)
Finite poset containing 24 elements
SymmetricGroupWeakOrderPoset(n, labels='permutations')

The poset of permutations with respect to weak order.

EXAMPLES:

sage: Posets.SymmetricGroupWeakOrderPoset(4)
Finite poset containing 24 elements
sage.combinat.posets.poset_examples.RandomPoset(*args, **kwds)

This function is deprecated and will be removed in a future version of Sage. Please use Posets.RandomPoset instead.

TESTS::
sage: RandomPoset(17,.15) doctest:1: DeprecationWarning: RandomPoset is deprecated, use Posets.RandomPoset instead! Finite poset containing 17 elements
sage.combinat.posets.poset_examples.SymmetricGroupBruhatOrderPoset(*args, **kwds)

This function is deprecated and will be removed in a future version of Sage. Please use Posets.SymmetricGroupBruhatOrderPoset instead.

TESTS::
sage: SymmetricGroupBruhatOrderPoset(3) doctest:1: DeprecationWarning: SymmetricGroupBruhatOrderPoset is deprecated, use Posets.SymmetricGroupBruhatOrderPoset instead! Finite poset containing 6 elements
sage.combinat.posets.poset_examples.SymmetricGroupWeakOrderPoset(*args, **kwds)

This function is deprecated and will be removed in a future version of Sage. Please use Posets.SymmetricGroupWeakOrderPoset instead.

TESTS::
sage: SymmetricGroupWeakOrderPoset(3) doctest:1: DeprecationWarning: SymmetricGroupWeakOrderPoset is deprecated, use Posets.SymmetricGroupWeakOrderPoset instead! Finite poset containing 6 elements

Previous topic

SemiLattices and Lattices

Next topic

Designs and Incidence Structures

This Page