Might be of interest to some that there is now a GPLv3 code for generating finite lattices. Paper is at

https://arxiv.org/pdf/1609.08255.pdf

code can be downloaded from

https://bitbucket.org/vgebhardt/unlabelled-lattices/downloads/

and it can be used for example like

from sage.combinat.posets.lattices import FiniteLatticePoset
from sage.categories.finite_lattice_posets import FiniteLatticePosets

import subprocess
def generate_lattices(n):  # Add check for the argument etc.

    
cmd=["/SOME/PATH/vgebhardt-unlabelled-lattices-367022714ef8/UnlabelledLattices"]
    args=[str(n)]
    sp=subprocess.Popen(cmd+args, shell=False, stdin=subprocess.PIPE, 
stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
    reader=iter(lambda: sp.stdout.read(n*(n-1)/2+1), '')
    while True:
        S=reader.next()[:-1]
        yield FiniteLatticePoset(DiGraph([range(n), lambda a, b: a < b and 
S[b*(b-1)/2+a]=='1']), category=FiniteLatticePosets())

I think someone, like me, should make an optional package from this.

--
Jori Mäntysalo

Reply via email to