Ticket #11584: trac_11584-doc.patch

File trac_11584-doc.patch, 3.5 KB (added by ncohen, 9 years ago)
  • sage/combinat/degree_sequences.pyx

    # HG changeset patch
    # User Nathann Cohen <nathann.cohen@gmail.com>
    # Date 1331996297 -3600
    # Node ID c76681cfa6209f9c8e8a88847b17872f7a28d202
    # Parent  2919de5ae8d8362c2b6f89703b9cfdc242b1f108
    DegreeSequences class -- additions in the documentation
    
    diff --git a/sage/combinat/degree_sequences.pyx b/sage/combinat/degree_sequences.pyx
    a b  
    6161degree sequence if and only if* `\forall i`
    6262
    6363.. MATH::
    64     \sum_{j\leq i}d_j \leq j(j-1) + \sum_{j>i}min(d_j,i)
     64    \sum_{j\leq i}d_j \leq j(j-1) + \sum_{j>i}\min(d_j,i)
    6565
    6666Alternatively, a degree sequence can be defined recursively :
    6767
     
    249249
    250250    As soon as the ``yield`` keyword is available in Cython this should be
    251251    changed. Updating the code does not require more than a couple of minutes.
    252    
     252
    253253"""
    254254
    255255##############################################################################
     
    259259#                  http://www.gnu.org/licenses/
    260260##############################################################################
    261261
    262 from sage.libs.gmp.all cimport mpz_t 
    263 from sage.libs.gmp.all cimport * 
    264 from sage.rings.integer cimport Integer 
     262from sage.libs.gmp.all cimport mpz_t
     263from sage.libs.gmp.all cimport *
     264from sage.rings.integer cimport Integer
    265265include '../../../../devel/sage/sage/ext/stdsage.pxi'
    266 include '../ext/cdefs.pxi'           
     266include '../ext/cdefs.pxi'
    267267include "../ext/interrupt.pxi"
    268268
    269269
     
    274274
    275275    def __init__(self, n):
    276276        r"""
    277         Constructor
     277        Degree Sequences
    278278
    279         TEST::
     279        An instance of this class represents the degree sequences of graphs on a
     280        given number `n` of vertices. It can be used to list and count them, as
     281        well as to test whether a sequence is a degree sequence. For more
     282        information, please refer to the documentation of the
     283        :mod:`DegreeSequence<sage.combinat.degree_sequences>` module.
    280284
    281             sage: DegreeSequences(6)
    282             Degree sequences on 6 elements
     285        EXAMPLE::
     286
     287            sage: DegreeSequences(8)
     288            Degree sequences on 8 elements
     289            sage: [3,3,2,2,2,2,2,2] in DegreeSequences(8)
     290            True
     291
    283292        """
    284293        self._n = n
    285294
     
    296305        cdef int n = self._n
    297306        if len(seq)!=n:
    298307            return False
    299        
     308
    300309        cdef int S = sum(seq)
    301310
    302311        # Partial represents the left side of Erdos and Gallai's inequality,
     
    364373        """
    365374        if seq != NULL:
    366375            free(seq)
    367            
     376
    368377cdef init(int n):
    369378    """
    370379    Initializes the memory and starts the enumeration algorithm.
     
    392401
    393402cdef inline add_seq():
    394403     """
    395      This function is called whenever a sequence is found. 
     404     This function is called whenever a sequence is found.
    396405
    397406     Build the degree sequence corresponding to the current state of the
    398407     algorithm and adds it to the sequences list.
     
    408417         for 0<= j < seq[i]:
    409418             s.append(i)
    410419
    411      sequences.append(s)   
     420     sequences.append(s)
    412421
    413422cdef void enum(int k, int M):
    414423    """
     
    481490        n_current_box = seq[current_box]
    482491        n_previous_box = seq[current_box-1]
    483492
    484         # Note to self, and others : 
    485         # 
     493        # Note to self, and others :
     494        #
    486495        # In the following lines, there are many incrementation/decrementation
    487496        # that *may* be replaced by only +1 and -1 and save some
    488497        # instructions. This would involve adding several "if", and I feared it