Ask Your Question
1

Obtaining integers from a linear extension of a poset.

asked 2019-03-05 09:21:13 -0600

joakim_uhlin gravatar image

updated 2019-08-28 03:21:48 -0600

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 11:27:22 -0600

rburing gravatar image

updated 2019-03-05 11:33:44 -0600

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 14:11:45 -0600 )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 09:21:13 -0600

Seen: 45 times

Last updated: Mar 05