(G)
return G
Return (square) matrix as sparse.
Return (square) matrix as sparse.
Return ( square ) matrix as sparse .
def asgraph(G):
    """Return (square) matrix as sparse."""
    if not (sparse.isspmatrix_csr(G) or sparse.isspmatrix_csc(G)):
        G = sparse.csr_matrix(G)

    if G.shape[0] != G.shape[1]:
        raise ValueError('expected square matrix')

    return G
def asgraph ( G ) : if not ( sparse . isspmatrix_csr ( G ) or sparse . isspmatrix_csc ( G ) ) : G = sparse . csr_matrix ( G ) if G . shape [ 0 ] != G . shape [ 1 ] : raise ValueError ( 'expected square matrix' ) return G