#12993: Bug in determining whether a poset is graded
-----------------------------------+----------------------------------------
       Reporter:  saliola          |         Owner:  sage-combinat
           Type:  defect           |        Status:  new          
       Priority:  major            |     Milestone:  sage-5.1     
      Component:  combinatorics    |    Resolution:               
       Keywords:  poset, combinat  |   Work issues:               
Report Upstream:  N/A              |     Reviewers:               
        Authors:                   |     Merged in:               
   Dependencies:                   |      Stopgaps:               
-----------------------------------+----------------------------------------

Comment (by saliola):

 Hello Darij,

 I took a quick look at your code and have a few comments.

  1. You should add the poset that Anne provided illustrating the bug as a
 doctest in the examples section. This way, it is guaranteed to work in all
 future versions of Sage.

  2. I see that you are trying to create a list of empty lists. An easier
 and more efficient way to do this is:

     [ [] for x in range(n) ]

  3. I see you are using these lists to construct lists of upper and lower
 covers. I think you should just use the {{{upper_covers}}} and
 {{{lower_covers}}} methods for posets, or the {{{neighbors_out}}}
 {{{neighbours_in}}} methods for Hasse diagrams.

  4. I would probably use a dictionary for {{{rank_fcn}}} instead of a
 list. This way you don't have to create a list of the required length
 beforehand.

  5. Your code first creates a function and then tests it to see if it is a
 rank function. Is it possible to do the tests as you are creating the
 function so that in case the poset is not graded, then we get an error as
 soon as one is detected? I haven't given it much thought. Maybe it isn't
 as efficient?

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12993#comment:2>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to