Ask Your Question
1

Poset whose elements are frozen sets

asked 2022-10-13 04:32:00 +0100

vukov gravatar image

I'm trying to create a poset whose elements are frozen sets (they are certain chains of subsets of flats of a matroid), and I'm getting unexpected behavior. For example:

sage: elts = [frozenset({1, 2, 3}), frozenset({3, 4, 5}), frozenset({1, 3, 4})]                                                                     
sage: rels = [frozenset({1,2,3}), frozenset({3,4,5})]                        
sage: Poset(elts, rels)                                                      
Finite poset containing 6 elements

The elements are:

frozenset({1, 2, 3})
2
frozenset({3, 4, 5})
3
4
5

Why does this happen?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-10-13 15:45:45 +0100

Max Alekseyev gravatar image

updated 2022-10-13 18:11:42 +0100

rels must be a list of (hashable) relations. In your code frozenset({1,2,3}), frozenset({3,4,5}) represents a single relation, but you did not provide it as such. To fix the issue, you need to make a tuple composed of these two sets. Also, elts and rels should be provided to Poset() as a single tuple:

elts = [frozenset({1, 2, 3}), frozenset({3, 4, 5}), frozenset({1, 3, 4})]                                                                     
rels = [ ( frozenset({1,2,3}), frozenset({3,4,5}) ) ]
Poset( (elts, rels) )
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2022-10-13 04:32:00 +0100

Seen: 70 times

Last updated: Oct 13 '22