1 | initial version |
Maybe something like this
sage: def banana(n):
....: for P in posets(n):
....: if not P.is_connected():
....: continue
....: H = P.hasse_diagram()
....: if H.to_undirected().is_tree():
....: continue
....: dg = H.transitive_closure()
....: if any(dg.degree(x) == n - 1 for x in dg):
....: continue
....: yield P