(G, weights, maxiter=None)
return mis
Compute a maximal independent set of a graph in parallel.

    Parameters
    ----------
    G : csr_matrix
        Matrix graph, G[i,j] != 0 indicates an edge
    weights : ndarray
        Array of weights for each vertex in the graph G
    maxiter : int
        Maximum number of iterations (default: None)

    Returns
    -------
    mis : array
        Array of length of G of zeros/ones indicating the independent set

    Examples
    --------
    >>> from pyamg.gallery import poisson
    >>> from pyamg.classical.split import MIS
    >>> import numpy as np
    >>> G = poisson((7,), format='csr') # 1D mesh with 7 vertices
    >>> w = np.ones((G.shape[0],1)).ravel()
    >>> mis = MIS(G,w)

    See Also
    --------
    fn = amg_core.maximal_independent_set_parallel
Compute a maximal independent set of a graph in parallel.
Compute a maximal independent set of a graph in parallel .
def MIS(G, weights, maxiter=None):
    """Compute a maximal independent set of a graph in parallel.

    Parameters
    ----------
    G : csr_matrix
        Matrix graph, G[i,j] != 0 indicates an edge
    weights : ndarray
        Array of weights for each vertex in the graph G
    maxiter : int
        Maximum number of iterations (default: None)

    Returns
    -------
    mis : array
        Array of length of G of zeros/ones indicating the independent set

    Examples
    --------
    >>> from pyamg.gallery import poisson
    >>> from pyamg.classical.split import MIS
    >>> import numpy as np
    >>> G = poisson((7,), format='csr') # 1D mesh with 7 vertices
    >>> w = np.ones((G.shape[0],1)).ravel()
    >>> mis = MIS(G,w)

    See Also
    --------
    fn = amg_core.maximal_independent_set_parallel

    """
    if not isspmatrix_csr(G):
        raise TypeError('expected csr_matrix')
    G = remove_diagonal(G)

    mis = np.empty(G.shape[0], dtype='intc')
    mis[:] = -1

    fn = amg_core.maximal_independent_set_parallel

    if maxiter is None:
        fn(G.shape[0], G.indptr, G.indices, -1, 1, 0, mis, weights, -1)
    else:
        if maxiter < 0:
            raise ValueError('maxiter must be >= 0')

        fn(G.shape[0], G.indptr, G.indices, -1, 1, 0, mis, weights, maxiter)

    return mis
def MIS ( G , weights , maxiter = None ) : if not isspmatrix_csr ( G ) : raise TypeError ( 'expected csr_matrix' ) G = remove_diagonal ( G ) mis = np . empty ( G . shape [ 0 ] , dtype = 'intc' ) mis [ : ] = - 1 fn = amg_core . maximal_independent_set_parallel if maxiter is None : fn ( G . shape [ 0 ] , G . indptr , G . indices , - 1 , 1 , 0 , mis , weights , - 1 ) else : if maxiter < 0 : raise ValueError ( 'maxiter must be >= 0' ) fn ( G . shape [ 0 ] , G . indptr , G . indices , - 1 , 1 , 0 , mis , weights , maxiter ) return mis