Re: [sage-devel] Re: Generating posets, lattices etc. up to isomorphism

2015-06-14 Thread Viviane Pons
Hi Jori,

when I want to iterate through posets, I do this:

sage: P3 = Posets(3); P3
Posets containing 3 vertices
sage: list(P3)
[Finite poset containing 3 elements,
 Finite poset containing 3 elements,
 Finite poset containing 3 elements,
 Finite poset containing 3 elements,
 Finite poset containing 3 elements]

The ``Posets`` function is in sage.combinat.posets.poset_example and when
given a number, it returns an instance of ``FinitePosets_n`` in
sage.combinat.posets.posets. I think for now, we only have the iteration up
to isomorphism.

>From a user point of view, it would seem natural to have something like

sage: Posets(3,  ... some options ...)
Posets containing 3 vertices with ... some options ...

which could indeed return a new class ``FinitePosets_n_with_properties`` in
the model of ``FinitePosets_n`` or even just allow those properties on
``FinitePosets_n`` (not sure which option is best).

Best,

Viviane

2015-06-14 9:40 GMT-05:00 Nathann Cohen :

> Would this be good interface:
>>
>> Posets_iterator(n, properties=None, width=None, height=None)
>>
>
> Do you have a specific reason for creating a class Posets_iterator? Or
> would a simple function do the job?
>
> Whatever you chose, it should probably be made available as an element of
> posets.. For graphs, you can do "list(graphs(6))", but you may want to
> not copy this kind of behaviour. It's up to you. You could also have
> posets.posets_iterator() or posets.posets_all() or posets.posets(),
> whichever you prefer (or others I did not think of).
>
> Then, you have the problem of the "Posets" object, exported in the global
> namespace. Right now, this thing is the "category of Posets". So if you
> want something like the following to work, you will have to mess with this
> category (or replace it by another object)
>
> sage: for p in Posets(max_width=3,max_height=4,num_points=90):
> : 
>
> Of course, its __iter__ method would be your iterator.
>
> Nathann
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-devel@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: Generating posets, lattices etc. up to isomorphism

2015-06-15 Thread Jori Mäntysalo

On Sun, 14 Jun 2015, Viviane Pons wrote:


From a user point of view, it would seem natural to have something like

sage: Posets(3,  ... some options ...)
Posets containing 3 vertices with ... some options ...

which could indeed return a new class ``FinitePosets_n_with_properties`` in
the model of ``FinitePosets_n`` or even just allow those properties on
``FinitePosets_n`` (not sure which option is best).


Actually I was only thinking about parameters. Is the form I suggested 
general enought? Of course it could, in theory, also have for example 
dimension=[a, b] -parameter, maybe also more.


There would be quite a much classes, if we implement many kinds of 
features to generation.


For lattices it sounds natural to have Lattices(n) like Posets(n), but 
lattices feels more like real subtype of posets than for example bounded 
posets.


--
Jori Mäntysalo


Re: [sage-devel] Re: Generating posets, lattices etc. up to isomorphism

2015-06-19 Thread Jori Mäntysalo

On Sun, 14 Jun 2015, Nathann Cohen wrote:


something like the following to work, you will have to mess with this
category (or replace it by another object)

sage: for p in Posets(max_width=3,max_height=4,num_points=90):
:     


I think that this can be done. But what about

Poset({0:[1]}) in Posets(2)

? If we would have something like "restricted posets", this would be a 
kind of filter.


I was only thinking about a function (or an iterator) giving posets. 
Somebody with more knowledge about Sage internals should think about 
classes and categories and so on.


--
Jori Mäntysalo