On Mon, 3 Apr 2017, Robin van der veer wrote:
I wonder if there is any way to use the join or meet operations in arbitrary
posets?
How fast that should be? The trivial implementation is just 4 lines long,
here with monkey patch:
def join2(self, a, b):
j = self.subposet([e for e in self.principal_upper_set(a) if e in
self.principal_upper_set(b)])
if len(j) > 1:
raise ValueError("no join for %s and %s" % (a, b))
return j[0]
type(Poset()).join = join2
P = Poset({1:[3, 4], 2:[3, 4], 3:[5], 4:[5]})
P.join(3, 4)
It sounds a little unnatural to have join or meet for all posets. Other
users might except L.join() to return an error if L is not a
join-semilattice.
--
Jori Mäntysalo