def testComplement(self):
        numVertices = 10
        numFeatures = 1

        vList = VertexList(numVertices, numFeatures)
        graph = self.GraphType(vList)

        graph3 = graph.complement()

        self.assertTrue(graph3.isUndirected())
        self.assertEquals(graph3.getNumEdges(), 2/(numVertices**2 + numVertices))

        graph.addEdge(0, 1, 0.1)
        graph.addEdge(2, 1, 0.2)
        graph.addEdge(4, 2, 0.5)
        graph.addEdge(6, 7, 0.9)
        graph.addEdge(3, 3, 1.1)

        graph2 = graph.complement()
    

        self.assertTrue(graph2.isUndirected())
        self.assertEquals(graph2.getEdge(0, 1), None)
        self.assertEquals(graph2.getEdge(2, 1), None)
        self.assertEquals(graph2.getEdge(4, 2), None)
        self.assertEquals(graph2.getEdge(6, 7), None)
        self.assertEquals(graph2.getEdge(3, 3), None)

        self.assertEquals(graph2.getEdge(0,0), 1)
        self.assertEquals(graph2.getNumEdges(), 50)

        #Now test on directed graphs
        vList = VertexList(numVertices, numFeatures)
        graph = self.GraphType(vList, False)

        graph3 = graph.complement()
        self.assertEquals(graph3.getNumEdges(), numVertices**2)

        graph.addEdge(0, 1, 0.1)
        graph.addEdge(2, 1, 0.2)
        graph.addEdge(4, 2, 0.5)
        graph.addEdge(6, 7, 0.9)
        graph.addEdge(3, 3, 1.1)

        graph2 = graph.complement()

        self.assertFalse(graph2.isUndirected())
        self.assertEquals(graph2.getEdge(0, 1), None)
        self.assertEquals(graph2.getEdge(2, 1), None)
        self.assertEquals(graph2.getEdge(4, 2), None)
        self.assertEquals(graph2.getEdge(6, 7), None)
        self.assertEquals(graph2.getEdge(3, 3), None)

        self.assertEquals(graph2.getEdge(0,0), 1)
        self.assertEquals(graph2.getEdge(1,0), 1)
        self.assertEquals(graph2.getNumEdges(), 95)
dataset/ETHPy150Open charanpald/APGL/apgl/graph/test/MatrixGraphTest.py/MatrixGraphTest.testComplement/swapped operands of `/`