#17002: Hasse diagrams: Trivial simplification for three functions
-------------------------------------+-------------------------------------
       Reporter:  jmantysalo         |        Owner:
           Type:  enhancement        |       Status:  needs_review
       Priority:  trivial            |    Milestone:  sage-6.4
      Component:  combinatorics      |   Resolution:
       Keywords:                     |    Merged in:
        Authors:                     |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/jmantysalo/poset_is_chain__trivial_simplification|  
b8b24e0a104864c62c24831cc3d7d366dbb98156
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------
Changes (by jmantysalo):

 * cc: ncohen (added)
 * commit:   => b8b24e0a104864c62c24831cc3d7d366dbb98156
 * status:  new => needs_review


Old description:

> A poset is chain if |V|-1=|E|, no vertex has out-degree >1 and no vertex
> has in-degree >1. Hence after #16984 code block
>
> {{{
> seen_0 = False
> for d in self.out_degree():
>     if d == 1:
>         pass
>     elif d == 0:
>         if seen_0:
>             return False
>          seen_0 = True
>      else:
>          return False
> }}}
>
> can be shortened to be just
>
> {{{
> if any(d>1 for d in self.out_degree()):
>     return False
> }}}

New description:

 A poset is chain if |V|-1=|E|, no vertex has out-degree >1 and no vertex
 has in-degree >1. Hence after #16984 it can be further simplified. Also
 `maximal_elements` and `minimal_elements` can use just `sources` and
 `sinks`.

--

Comment:

 New commits:
 
||[http://git.sagemath.org/sage.git/commit/?id=b8b24e0a104864c62c24831cc3d7d366dbb98156
 b8b24e0]||{{{Simplification of is_chain, maximal_elements and
 minimal_elements.}}}||

--
Ticket URL: <http://trac.sagemath.org/ticket/17002#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 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