ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 10 Oct 2017 22:12:28 +0200Obtaining lattices quickly in SAGEhttps://ask.sagemath.org/question/38936/obtaining-lattices-quickly-in-sage/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.Thu, 21 Sep 2017 22:52:33 +0200https://ask.sagemath.org/question/38936/obtaining-lattices-quickly-in-sage/Answer by jipilab for <p>At the moment I use </p>
<pre><code>posets = [p for p in Posets(n) if p.is_connected() and p.is_lattice()]
</code></pre>
<p>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.</p>
https://ask.sagemath.org/question/38936/obtaining-lattices-quickly-in-sage/?answer=39091#post-id-39091It 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...Mon, 09 Oct 2017 17:32:59 +0200https://ask.sagemath.org/question/38936/obtaining-lattices-quickly-in-sage/?answer=39091#post-id-39091Comment by dan_fulea for <p>It is not usual to bundle a database of combinatorial objects coming with Sage by default.</p>
<p>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.</p>
<p>That said, depending on what you want to do, you could use an iterator:</p>
<pre><code>n_elmt = 7
connected_lattice_iterator = (p for p in Posets(n_elmt) if p.is_connected() and p.is_lattice())
</code></pre>
<p>to generate all connected lattices one by one, but it does not increase the speed of generation...</p>
https://ask.sagemath.org/question/38936/obtaining-lattices-quickly-in-sage/?comment=39095#post-id-39095This 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.Tue, 10 Oct 2017 04:02:39 +0200https://ask.sagemath.org/question/38936/obtaining-lattices-quickly-in-sage/?comment=39095#post-id-39095Comment by jipilab for <p>It is not usual to bundle a database of combinatorial objects coming with Sage by default.</p>
<p>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.</p>
<p>That said, depending on what you want to do, you could use an iterator:</p>
<pre><code>n_elmt = 7
connected_lattice_iterator = (p for p in Posets(n_elmt) if p.is_connected() and p.is_lattice())
</code></pre>
<p>to generate all connected lattices one by one, but it does not increase the speed of generation...</p>
https://ask.sagemath.org/question/38936/obtaining-lattices-quickly-in-sage/?comment=39105#post-id-39105This is true. I appended the answer.Tue, 10 Oct 2017 22:12:28 +0200https://ask.sagemath.org/question/38936/obtaining-lattices-quickly-in-sage/?comment=39105#post-id-39105