Ask Your Question

Obtaining lattices quickly in SAGE

asked 2017-09-21 22:52:33 +0100

sagequstions gravatar image

updated 2019-08-29 18:41:25 +0100

FrédéricC gravatar image

At the moment I use

posets = [p for p in Posets(n) if p.is_connected() and p.is_lattice()]

to obtain all connected lattices via SAGE. But this takes terrible long for n>=8. Is there a quicker way? It would somehow be natural when the connected lattices (or just connected posets) are saved in SAGE for some small n so that one does not have to filter trough the very large set of all posets. For example there are 53 connected lattices with 7 points , while there are 2045 posets on 7 points.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2017-10-09 17:32:59 +0100

jipilab gravatar image

updated 2017-10-10 22:09:44 +0100

It is not usual to bundle a database of combinatorial objects coming with Sage by default.

It would be nice to have a (fast) enumerated set of all lattices on a given number of elements. Although my impression is that the set of lattices on a given number of vertices is not easy to generate recursively. Indeed, the lattice property of a poset does not behave well with respect to inclusion, so a recursive enumeration would not work as smoothly as it does for posets.

That said, depending on what you want to do, you could use an iterator:

n_elmt = 7
connected_lattice_iterator = (p for p in Posets(n_elmt) if p.is_connected() and p.is_lattice())

to generate all connected lattices one by one, but it does not increase the speed of generation...

edit flag offensive delete link more


This is a sort of an echo of the posted

posets = [p for p in Posets(n) if p.is_connected() and p.is_lattice()]

And the iterator is slow generator. The point remains: too few connected lattices among all posets on e.g a seven elements given vertex set.

dan_fulea gravatar imagedan_fulea ( 2017-10-10 04:02:39 +0100 )edit

This is true. I appended the answer.

jipilab gravatar imagejipilab ( 2017-10-10 22:12:28 +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


Asked: 2017-09-21 22:52:33 +0100

Seen: 319 times

Last updated: Aug 29 '19