def setWeightMatrixSparse(self, W):      
        
        if not isinstance(W, spmatrix.LLMatType) and not sparse.issparse(W):
            raise ValueError("Input must be a sparse matrix, not " + str(type(W)))

        if W.shape != (self.vList.getNumVertices(), self.vList.getNumVertices()):
            raise ValueError("Weight matrix has wrong shape : " + str(W.shape))
        
        try: 
            self.W = spmatrix.ll_mat(W.shape[0], W.shape[0], W.getnnz())
        except AttributeError: 
            self.W = spmatrix.ll_mat(W.shape[0], W.shape[0], W.nnz)
      
        if isinstance(W, spmatrix.LLMatType): 
            #Warning: no check for symmetric matrix 
            #if self.undirected:
            #    raise ValueError("Weight matrix of undirected graph must be symmetric")
        
            items = W.items()
            
            for inds, val in items:
                self.W[inds[0], inds[1]] = val
        else: 
            if self.undirected and (W - W.transpose()).nonzero()[0].shape[0]:
                raise ValueError("Weight matrix of undirected graph must be symmetric")
            
            rowInds, colInds = W.nonzero()
                  
            for i in range(rowInds.shape[0]):
                self.W[int(rowInds[i]), int(colInds[i])] = W[int(rowInds[i]), int(colInds[i])]
Attempts to normalize a list (column) of string values to booleans, integers,
dataset/ETHPy150Open charanpald/APGL/apgl/graph/PySparseGraph.py/PySparseGraph.setWeightMatrixSparse--crossover with--dataset/ETHPy150Open wireservice/csvkit/csvkit/typeinference.py/normalize_column_type