def __init__(self, vertices, undirected=True, W=None, dtype=numpy.float, frmt="csr"):
        Parameter.checkBoolean(undirected)
        
        if isinstance(vertices, AbstractVertexList):
            self.vList = vertices
        elif isinstance(vertices, int): 
            self.vList = GeneralVertexList(vertices)
        else: 
            raise ValueError("Invalid vList parameter: " + str(vertices))
          
        if W != None and not (sparse.issparse(W) and W.shape == (self.vList.getNumVertices(), self.vList.getNumVertices())):
            raise ValueError("Input argument W must be None or sparse matrix of size " + str(self.vList.getNumVertices()) )          
          
        self.undirected = undirected

        if frmt=="lil": 
            matrix = sparse.lil_matrix
        elif frmt=="csr": 
            matrix = sparse.csr_matrix
        elif frmt=="csc": 
            matrix = sparse.csc_matrix   
        else: 
            raise ValueError("Invalid sparse matrix format: " + frmt)
            
        #Terrible hack alert:  can't create a zero size sparse matrix, so we settle
        #for one of size 1. Better is to create a new class. 
        if self.vList.getNumVertices() == 0 and W == None:
            self.W = matrix((1, 1), dtype=dtype)
        elif W == None:
            self.W = matrix((self.vList.getNumVertices(), self.vList.getNumVertices()), dtype=dtype)
        else:
            self.W = W 
            #The next line is for error checking mainly 
            self.setWeightMatrix(W)
Create a SparseGraph with a given AbstractVertexList or number of 
dataset/ETHPy150Open charanpald/APGL/apgl/graph/SparseGraph.py/SparseGraph.__init__