def generate(self, graph, requireEmpty=True):
        Parameter.checkClass(graph, AbstractMatrixGraph)
        if requireEmpty and graph.getNumEdges()!= 0:
            raise ValueError("Graph must have no edges")
        if graph.getNumVertices() != self.outDegSequence.shape[0]:
            raise ValueError("Graph must have same number of vertices as degree sequence")
        if self.getInDegSequence()!=None and graph.isUndirected():
            raise ValueError("In-degree sequence must be used in conjunction with directed graphs")

        if self.getInDegSequence()==None:
            expandedInds = Util.expandIntArray(self.outDegSequence)
            numpy.random.shuffle(expandedInds)
            for i in range(0, len(expandedInds), 2):
                if i != len(expandedInds)-1:
                    graph.addEdge(expandedInds[i], expandedInds[i+1])
        else:
            expandedOutInds = Util.expandIntArray(self.outDegSequence)
            expandedInInds = Util.expandIntArray(self.inDegSequence)
            numpy.random.shuffle(expandedOutInds)
            numpy.random.shuffle(expandedInInds)

            for i in range(numpy.min(numpy.array([expandedOutInds.shape[0], expandedInInds.shape[0]]))):
                graph.addEdge(expandedOutInds[i], expandedInInds[i])

        return graph
Create an Configuration Model graph. Note the the degree sequence(s) given
dataset/ETHPy150Open charanpald/APGL/apgl/generator/ConfigModelGenerator.py/ConfigModelGenerator.generate