#19197: LatticePoset: add breadth()
-------------------------------------+-------------------------------------
       Reporter:  jmantysalo         |        Owner:
           Type:  enhancement        |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.9
      Component:  combinatorics      |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Jori Mäntysalo     |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/jmantysalo/latticeposet__add_breadth__|  
33610ad2c4327679b8dfc1d3af445fe4d9080e4a
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by jmantysalo):

 Replying to [comment:15 ncohen]:

 > - I was very surprised to see a 'distance' argument in the depth-first-
 search
 >   function. You do not compute the 'distance' when running a
 >   depth-first-search. At least not the usual notion of distance in graph
 >   theory. We should probably remove it, as it is *highly* dangerous to
 advertise
 >   it this way `O_o`

 For me the parameter name `distance` feels very clear. But could like also
 `max_depth`. I think that it is useful to have a function that tells for
 example to what cities you can reach using max three bus.

 > - In your code, please use breadth-first-search instead.

 Why? Doesn't it use more memory?

 > - Definition of 'elems': this line often test for containment in
 'too_close'. Do
 >   not run containment tests in a list. use a 'set' for that: containment
 is
 >   faster.

 OK.

 > - Anyway, you probably should do this differently, i.e. with
 >   `breadth_first_search(report_distance=True)` while filtering 'too
 close'
 >   elements according to their distance.

 I can test and see what happens. But I must make some test lattices, maybe
 some ordinal sum of ordinal products.

 > - I still believe that it would be faster to use
 >   'subsets_with_hereditary_property' inside of your code.

 I am not sure about that. If I am right, it will make all 2-element
 antichains, then all 3-element antichains and so on. There will be many of
 them, only one is needed. (But the one must be the right one, of
 course...)

 > - Why do you deal with breadth 2 differently from the rest?

 There was some complication with breadth 2. Maybe it is not needed now in
 the near-to-final version.

 And then, this depends on what one is doing. I guess it makes no
 difference for a big lattice, but for `10^4` small it might be different
 thing.

 > Besides that, congratulations for this algorithm. It works, and it works
 well.

 Thanks! And thanks for the comments.

--
Ticket URL: <http://trac.sagemath.org/ticket/19197#comment:16>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to