def testAdd(self):
        numVertices = 5
        numFeatures = 3
        vList = VertexList(numVertices, numFeatures)

        graph = self.GraphType(vList, False)
        graph.addEdge(0, 1)
        graph.addEdge(0, 2)
        graph.addEdge(0, 3)
        graph.addEdge(2, 1)

        graph2 = self.GraphType(vList, False)
        graph2.addEdge(3, 2)
        graph2.addEdge(0, 4)
        graph2.addEdge(1, 3)
        graph2.addEdge(2, 1)

        newGraph = graph.add(graph2)

        #Check old graph is the same
        self.assertEquals(graph.getEdge(0,1) , 1)
        self.assertEquals(graph.getEdge(0,2) , 1)
        self.assertEquals(graph.getEdge(0,3) , 1)
        self.assertEquals(graph.getEdge(2,1) , 1)

        self.assertEquals(newGraph.getEdge(0,1) , 1)
        self.assertEquals(newGraph.getEdge(0,2) , 1)
        self.assertEquals(newGraph.getEdge(3,2) , 1)
        self.assertEquals(newGraph.getEdge(2,1) , 2)

        #Test edge addition of different sized graphs
        vList2 = VertexList(numVertices-1, numFeatures)
        graph2 = self.GraphType(vList2, False)
        graph2.addEdge(3, 2)

        self.assertRaises(ValueError, graph.add, graph2)
dataset/ETHPy150Open charanpald/APGL/apgl/graph/test/MatrixGraphTest.py/MatrixGraphTest.testAdd/original