Ask Your Question
1

Obtaining integers from a linear extension of a poset.

asked 2019-03-05 16:21:13 +0200

joakim_uhlin gravatar image

updated 2019-08-28 10:21:48 +0200

FrédéricC gravatar image

I'm quite new to Sage so this might be a very easy question.

Suppose that I have defined a linear extension of a poset in Sage like this:

P = Poset(([1,2,3,4], [[1,3],[1,4],[2,3]]), linear_extension=True, facade=False)
p = P.linear_extension([1,4,2,3])

Is there a way for me to make this linear extension into a permutation? That is, I would like to obtain the permutation [1,4,2,3] from p.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2019-03-05 18:27:22 +0200

rburing gravatar image

updated 2019-03-05 18:33:44 +0200

This is not my field, but it seems you can do

sage: map(lambda x: x.element, p)
[1, 4, 2, 3]
sage: sigma = Permutation(map(lambda x: x.element, p))
sage: sigma
[1, 4, 2, 3]
sage: sigma(2)
4
edit flag offensive delete link more

Comments

2

More pythonic:

sage: Permutation(x.element for x in p)
[1, 4, 2, 3]

Or just use facade=True

FrédéricC gravatar imageFrédéricC ( 2019-03-05 21:11:45 +0200 )edit

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: 2019-03-05 16:21:13 +0200

Seen: 251 times

Last updated: Mar 05 '19