Return the degree of a vertex

def degree(self, vertex):
        """
        Return the degree of a vertex
        """
        try:
            return len(self.vertices[vertex])
        except KeyError:
            raise GraphInsertError("Vertex %s doesn't exist." % (vertex,))