# Library of posets in GAP?

Is there a way to obtain in GAP the Hasse diagrams of famous posets like the partition lattice or the divisor lattice of an integer? If they are not saved, is there a way to get them somehow else, like with using SAGE? If not, is there a trick to obtain the Hasse diagram easily without programming everything from the start? Are small posets or lattice saved in GAP? Like the ones with at most 7 points.

• I suggest to look at FindStat, especially findstat.org/Posets. See also arxiv.org/abs/1401.3690 Sep 9 '17 at 22:23
• @AlexanderKonovalov thanks, so in GAP (or a GAP package) alone no librarys or similar things exist for posets?
– Mare
Sep 9 '17 at 23:20
• Not that I am aware of. You may ask the GAP Forum in case someone may have it (perhaps in some list encoding, since GAP has now such data type, but hopefully readable in GAP then). I have listed some standalone mathematical databases here - will be interested to add it to the list, if it exists. Sep 10 '17 at 16:04

Sage has a built-in Poset class with pretty broad functionality. This Sage cell gives a pretty boring example:

P = posets(5)
for p in P:
p.show()
print('\n')


For something more specific, you can look at the catalog of posets/lattices and use some of the graph plotting options:

posets.IntegerPartitions(10).hasse_diagram().show(figsize=[10,10])


For a better experience you'll probably want to be more sophisticated with the plot options, such as using this option:

heights A dictionary mapping heights to the list of vertices at this height.

Concerning the specific question: No, GAP has no formal poset'' data type and thus also does not have a library of posets. However it is likely that such a library exists as a standalone resource on the web.

• and for lattices? Sep 15 '17 at 15:19

Although GAP has no formal poset data type, the homology package does have such a type, and has some of the examples that you speak of built-in. It's difficult to build the compiled portion of the library, but pretty much all of the poset stuff should work without compiling. Unfortunately, I don't think the poset support in this package is hooked up to anything that will display Hasse diagrams.

There are two ways I know of to display Hasse diagrams of subgroup lattices in GAP, both requiring some additional software:

It's not too difficult to display Hasse diagrams in xgap or Gap.app. The built-in code handles only subgroup lattices. I have (unpolished) code that draws partition lattices in these systems. For what it's worth, I'll post it to my webpage. It at least will serve as a model for how to display Hasse diagrams of new posets in xgap or Gap.app.

Note that you need Xwindows (on Linux or other Unix-like system) to run xgap, or a Mac to run Gap.app.

You could also look at the routine DotFileLatticeSubgroups. That exports a subgroup lattice to a GraphViz file, which you can then turn into a picture of the Hasse diagram. See e.g. this question.

It does, it's mentioned in Macaulay2's docs here

The GAP package Simplicial Homology, available at http://www.eecis.udel.edu/~dumas/Homology/, provides methods for using posets within GAP. According to the documentation, posets are stored in GAP in the following manor: The ground set is the set of integers 1..n+1 and the relations are stored in a list of length n, where the ith entry is the set of vertices which cover i in the poset. In particular, 1 should be the unique minimal element and n+1 should be the unique maximal element.

Note that this is not the simpcomp package.
I'm looking into the same problem and didn't know about the heights parameter in Sage, I'll probably use that instead but leaving this note in case it helps.