Hi folks,

I'm trying to do some clean-ups [1] of the C graph module

sage/graphs/base/c_graph.pyx

I'm almost done and am about to finish off a patch. However, I need
some clarification for the method degree() of the class CGraphBackend.
As of Sage 4.4.alpha1, the definition of this method is as follows:

def degree(self, v, directed):
    """
    Return the degree of the vertex ``v``.

    INPUT:

    - ``v`` - a vertex of the graph

    EXAMPLE::

        sage: from sage.graphs.base.sparse_graph import SparseGraphBackend
        sage: B = SparseGraphBackend(7)
        sage: B.degree(3, False)
        0

    """
    cdef v_int = get_vertex(v, self.vertex_ints, self.vertex_labels, self._cg)
    if directed:
        return self._cg._in_degree(v_int) + self._cg._out_degree(v_int)
    else:
        return self._cg._out_degree(v_int)


What I don't understand is the purpose of the keyword "directed". Is
it meant to signify whether or not we want to consider the orientation
of the graph when counting the degree of a vertex?


[1] http://trac.sagemath.org/sage_trac/ticket/8733

-- 
Regards
Minh Van Nguyen

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to