Ticket #7569: trac_7569_review-abm.patch

File trac_7569_review-abm.patch, 2.6 KB (added by abmasse, 11 years ago)

Review patch with formatting of code and doc -- apply on top of Nathann's patch

  • sage/graphs/generic_graph.py

    # HG changeset patch
    # User Alexandre Blondin Masse < alexandre.blondin.masse at gmail.com>
    # Date 1269275120 -3600
    # Node ID 98a2938bf74039505e6c75eb26095599228e295c
    # Parent  de040244edb2652600a6b186c226314e622a8cb5
    #7569 Review formatting of code and documentation
    
    diff --git a/sage/graphs/generic_graph.py b/sage/graphs/generic_graph.py
    a b class GenericGraph(GenericGraph_pyx): 
    45794579
    45804580    __contains__ = has_vertex
    45814581
    4582     def random_vertex(self,**kwds):
    4583         r"""
    4584         Returns a random vertex.
    4585 
    4586         INPUT:
    4587 
    4588         - ``**kwds`` -- arguments to be passed down to the
     4582    def random_vertex(self, **kwds):
     4583        r"""
     4584        Returns a random vertex of self.
     4585
     4586        INPUT:
     4587
     4588        - ``**kwds`` - arguments to be passed down to the
    45894589          ``vertex_iterator`` method.
    45904590
    45914591        EXAMPLE:
    45924592
    4593         The returned value belong to the set of vertices::
     4593        The returned value is a vertex of self::
    45944594
    45954595            sage: g = graphs.PetersenGraph()
    45964596            sage: v = g.random_vertex()
    45974597            sage: v in g
    45984598            True
    45994599        """
    4600 
    46014600        from sage.misc.prandom import randint
    46024601        it = self.vertex_iterator(**kwds)
    4603         for i in xrange(0, randint(0,self.order()-1)):
     4602        for i in xrange(0, randint(0, self.order() - 1)):
    46044603            it.next()
    4605 
    46064604        return it.next()
    46074605
    46084606    def random_edge(self,**kwds):
    46094607        r"""
    4610         Returns a random edge.
    4611 
    4612         INPUT:
    4613 
    4614         - ``**kwds`` -- arguments to be passed down to the
     4608        Returns a random edge of self.
     4609
     4610        INPUT:
     4611
     4612        - ``**kwds`` - arguments to be passed down to the
    46154613          ``edge_iterator`` method.
    46164614
    46174615        EXAMPLE:
    46184616
    4619         The returned value belong to the set of edges::
     4617        The returned value is an edge of self::
    46204618
    46214619            sage: g = graphs.PetersenGraph()
    46224620            sage: u,v = g.random_edge(labels=False)
    class GenericGraph(GenericGraph_pyx): 
    46254623
    46264624        As the ``edges()`` method would, this function returns
    46274625        by default a triple ``(u,v,l)`` of values, in which
    4628         ``l`` is the label of edge `u,v` ::
     4626        ``l`` is the label of edge `(u,v)`::
    46294627
    46304628            sage: g.random_edge()
    46314629            (...,...,...)
    46324630        """
    4633 
    46344631        from sage.misc.prandom import randint
    46354632        it = self.edge_iterator(**kwds)
    4636         for i in xrange(0, randint(0,self.size()-1)):
     4633        for i in xrange(0, randint(0, self.size() - 1)):
    46374634            it.next()
    4638 
    46394635        return it.next()                           
    46404636
    46414637    def vertex_boundary(self, vertices1, vertices2=None):