Ask Your Question
0

Obtaining a poset from a matrix

asked 2023-04-30 16:11:07 +0100

klaaa gravatar image

I have an upper triangular matrix M with entries only 0 or 1 where all diagonal entries are 1. I want to use Sage to test whether M is the lequal_matrix of a finite poset and to obtain that poset via Sage if this is the case. Is there an easy way to do this? I did not find anything i the poset manual that seems to work. Thanks for any help!

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2023-04-30 21:55:02 +0100

FrédéricC gravatar image

Like this

sage: m = matrix(ZZ,2,2,[1,1,0,1])
sage: Poset(DiGraph(m-1, loops=False))
Finite poset containing 2 elements
edit flag offensive delete link more

Comments

Perhaps this needs to be enclosed into try: ... except: ... to handle cases when matrix does not define a poset.

Max Alekseyev gravatar imageMax Alekseyev ( 2023-05-04 15:15:30 +0100 )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: 2023-04-30 16:11:07 +0100

Seen: 132 times

Last updated: Apr 30 '23