Hi Nathann,
> I am writing a pretty simple code, which generates several subsets of [n]. I
> would like to take from this list of subsets the list of maximal elements,
> which I feel should be the job of the Poset class, though it looks like it
> only accepts DiGraph as an input...
>
> Well, do you think it could be useful to add to it something to create
> posets from, for example, a set of elements and a lambda function returning
> true or false to represent the partial order ?
For some reason asking Poset? doesn't print the doc (I've not time
investigating this now). However if you ask
sage: print(Poset.__doc__)
you'll get a long page describing how to build a poset:
"""
Construct a poset from various forms of input data.
INPUT:
1. A two-element list or tuple (E, R), where E is a collection of
elements of the poset and R is the set of relations. Elements
of R are two-element lists/tuples/iterables. If
cover_relations=True, then R is assumed to be the cover
relations of the poset. If E is empty, then E is taken to be
the set of elements appearing in the relations R.
2. A two-element list or tuple (E, f), where E is the set of
elements of the poset and f is a function such that f(x,y) is
True if x <= y and False otherwise for all pairs of elements in
E. If cover_relations=True, then f(x,y) should be True if and
only if x is covered by y, and False otherwise.
[...]
"""
I think 2. is exactly what you want.
Cheers,
Florent
--
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
To unsubscribe from this group, send email to
sage-devel+unsubscribegooglegroups.com or reply to this email with the words
"REMOVE ME" as the subject.