def setWeightMatrix(self, W):
        #Parameter.checkClass(W, numpy.ndarray)

        if W.shape != (self.vList.getNumVertices(), self.vList.getNumVertices()):
            raise ValueError("Weight matrix has wrong shape : " + str(W.shape))

        if self.undirected and type(W) == numpy.ndarray and (W != W.T).any():
            raise ValueError("Weight matrix of undirected graph must be symmetric")

        self.W = spmatrix.ll_mat(self.getNumVertices(), self.getNumVertices())
        
        if type(W) == numpy.ndarray:         
            rowInds, colInds = numpy.nonzero(W)
            self.W.put(W[(rowInds, colInds)], rowInds, colInds)
        elif isinstance(W, spmatrix.LLMatType): 
            self.setWeightMatrixSparse(W)
        else: 
            raise ValueError("Invalid matrix type: " + str(type(W)))
Set the weight matrix of this graph. Requires as input an ndarray with the
dataset/ETHPy150Open charanpald/APGL/apgl/graph/PySparseGraph.py/PySparseGraph.setWeightMatrix