Hello Anne, On Wed, May 23, 2012 at 1:43 AM, Anne Schilling <a...@math.ucdavis.edu> wrote: > > On 5/22/12 6:17 PM, Franco Saliola wrote: > > > > Hello Anne, Darij, > > > > On Tue, May 22, 2012 at 2:50 PM, Darij Grinberg <darijgrinb...@gmail.com > > <mailto:darijgrinb...@gmail.com>> wrote: > > > > Hi Anne, > > > > > For a finite poset perhaps the easiest would be to > > > > > > - start with a random element in the poset, assign rank 0 > > > - look at all covers and cocovers and assign the rank according to the > > > recurrence rank(x) = rank(y) + 1 if x covers y. > > > - repeat with the new elements > > > - if at any point an element is reached again and is assigned a > > different > > > value from before, the poset is not graded; otherwise continue with > > new > > > elements > > > > > > Add some constant to all ranks, so that the minimal rank is 0. > > > > You are right - I was trying to apply algebra too eagerly. This is > > basically a Dijkstra algorithm. > > > > > Darij, do you think you can implement this? > > > > Here's a stupid implementation: > > http://mit.edu/~darij/www/rf.txt > > (to replace the rank_function implementation in > > sage/combinat/posets/hasse-diagram.py). > > Unfortunately I couldn't really test it in context since I have no > > idea how to make Sage recognize my changes to the sourcecode. ("./sage > > -combinat upgrade" notices the change but wants me to qrefresh, > > whatever this means; I haven't yet got around to learning hg.) > > I have checked that, when applied to a poset's Hasse diagram, it gives > > the right results. > > > > > > I created a ticket for this: > > > > http://trac.sagemath.org/sage_trac/ticket/12993 > > > > I'm going to post some comments for Darij there. > > Thank you, Franco! Does this mean you agree that this is a bug?
Well, I agree that your poset has a rank function, so the rank_function method needs to be modified. And I think that P.is_ranked() should return True in this case (it will once the rank_function method is corrected). As for whether "graded" is a synonym for "ranked", that's up for discussion. Stanley's "Enumerative Combinatorics" defines a graded poset as one in which all maximal chains have the same length. Since we have two notions here, perhaps we can include both. For example: - a poset is *ranked* if it admits a rank function; so P.is_ranked() will return True for Anne's example. - a poset if *graded* if all maximal chains have the same length; so P.is_graded() will return Fase for Anne's example. Thoughts? Other terms to distinguish between these two definitions? Some authors (Wachs, Björner, ...) use *pure* for graded in Stanley's sense. > Darij, please also add more documentation to the is_ranked, is_graded > rank_function methods to say how grading is defined (so that it is clear > for future users). +1 Franco -- -- 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.