On Sat, Feb 11, 2012 at 11:11:31AM -0800, Anne Schilling wrote: > > If yes, then maybe something like: > > > > P = Poset(...) > > Q = P.enumerated_by(<some linear_extension of P>) > > Yes, in my last e-mail, I already sent the code for this (what I > called from_linear_extension you call enumerated_by):
I know, I was just suggesting a name for it. > Well, at the end it will give a graph on the set of all linear extensions. > Promotion (or the generalized promotions as well) for example, take as input > a poset P > and out comes another poset (with its vertices relabeled). It is most > convenient to program this directly on the linear extension of P. But > in Sage there is no class for linear extensions and as far as I can see > no method that converts between linear extensions and actual posets. Thanks for the clarification. Let me restate it to check I am having it right. You have a poset, say: sage: P = Poset((divisors(30), attrcall("divides"))) and then you want to manipulate a bunch of linear extensions of that poset like:: sage: l1 = [1, 5, 3, 2, 10, 6, 15, 30] sage: l2 = [1, 2, 3, 5, 6, 15, 10, 30] ... Then, to apply an operation `blah` on a linear extension of P, you need both P and the linear extension. A first approach is to put blah as a method of P:: sage: P.blah(l1) ... Another approach is to have a class LinearExtensionOfPoset so that one can do:: sage: l1 = LinearExtensionOfPoset(P, [1, 5, 3, 2, 10, 6, 15, 30]) sage: l1.blah() ... The choice depends mostly on how many methods one wants to have: for more than two or three, it is indeed more reasonable to not pollute P's namespace. By the way, one might event want to have a class LinearExtensionsOfPoset:: sage: L = LinearExtensionsOfPoset(P); L The set of all linear extensions of L sage: L.cardinality() ... sage: L.an_element(): ... And then one could do something like: sage: L.promotion_graph() A variant of the above would be to have L be a facade parent, and call the operations like `blah` as: sage: L.blah(l1) > I already implemented my algorithms. I just do not know where to put them > in /combinat/posets.py since there is no class for linear extensions. > For their analogs on posets it is clear, but it is useful to have the helper > methods on linear extensions directly. I was precisely asking about (the names of) those helper methods to see if it was worth creating that new class LinearExtensionOfPoset. Cheers, Nicolas -- Nicolas M. ThiƩry "Isil" <nthi...@users.sf.net> http://Nicolas.Thiery.name/ -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To post to this group, send email to sage-combinat-devel@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.