# 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 class GenericGraph(GenericGraph_pyx): __contains__ = has_vertex def random_vertex(self,**kwds): r""" Returns a random vertex. INPUT: - ``**kwds`` -- arguments to be passed down to the def random_vertex(self, **kwds): r""" Returns a random vertex of self. INPUT: - ``**kwds`` - arguments to be passed down to the ``vertex_iterator`` method. EXAMPLE: The returned value belong to the set of vertices:: The returned value is a vertex of self:: sage: g = graphs.PetersenGraph() sage: v = g.random_vertex() sage: v in g True """ from sage.misc.prandom import randint it = self.vertex_iterator(**kwds) for i in xrange(0, randint(0,self.order()-1)): for i in xrange(0, randint(0, self.order() - 1)): it.next() return it.next() def random_edge(self,**kwds): r""" Returns a random edge. INPUT: - ``**kwds`` -- arguments to be passed down to the Returns a random edge of self. INPUT: - ``**kwds`` - arguments to be passed down to the ``edge_iterator`` method. EXAMPLE: The returned value belong to the set of edges:: The returned value is an edge of self:: sage: g = graphs.PetersenGraph() sage: u,v = g.random_edge(labels=False) class GenericGraph(GenericGraph_pyx): As the ``edges()`` method would, this function returns by default a triple ``(u,v,l)`` of values, in which ``l`` is the label of edge `u,v` :: ``l`` is the label of edge `(u,v)`:: sage: g.random_edge() (...,...,...) """ from sage.misc.prandom import randint it = self.edge_iterator(**kwds) for i in xrange(0, randint(0,self.size()-1)): for i in xrange(0, randint(0, self.size() - 1)): it.next() return it.next() def vertex_boundary(self, vertices1, vertices2=None):