(self, *args)
return result
Returns some k-cores of the graph.

        The method accepts an arbitrary number of arguments representing
        the desired indices of the M{k}-cores to be returned. The arguments
        can also be lists or tuples. The result is a single L{Graph} object
        if an only integer argument was given, otherwise the result is a
        list of L{Graph} objects representing the desired k-cores in the
        order the arguments were specified. If no argument is given, returns
        all M{k}-cores in increasing order of M{k}.
Returns some k-cores of the graph.
Returns some k - cores of the graph .
def k_core(self, *args):
        """Returns some k-cores of the graph.

        The method accepts an arbitrary number of arguments representing
        the desired indices of the M{k}-cores to be returned. The arguments
        can also be lists or tuples. The result is a single L{Graph} object
        if an only integer argument was given, otherwise the result is a
        list of L{Graph} objects representing the desired k-cores in the
        order the arguments were specified. If no argument is given, returns
        all M{k}-cores in increasing order of M{k}.
        """
        if len(args) == 0:
            indices = range(self.vcount())
            return_single = False
        else:
            return_single = True
            indices = []
            for arg in args:
                try:
                    indices.extend(arg)
                except Exception:
                    indices.append(arg)

        if len(indices) > 1 or hasattr(args[0], "__iter__"):
            return_single = False

        corenesses = self.coreness()
        result = []
        vidxs = range(self.vcount())
        for idx in indices:
            core_idxs = [vidx for vidx in vidxs if corenesses[vidx] >= idx]
            result.append(self.subgraph(core_idxs))

        if return_single:
            return result[0]
        return result
def k_core ( self , * args ) : if len ( args ) == 0 : indices = range ( self . vcount ( ) ) return_single = False else : return_single = True indices = [ ] for arg in args : try : indices . extend ( arg ) except Exception : indices . append ( arg ) if len ( indices ) > 1 or hasattr ( args [ 0 ] , "__iter__" ) : return_single = False corenesses = self . coreness ( ) result = [ ] vidxs = range ( self . vcount ( ) ) for idx in indices : core_idxs = [ vidx for vidx in vidxs if corenesses [ vidx ] >= idx ] result . append ( self . subgraph ( core_idxs ) ) if return_single : return result [ 0 ] return result