def testVertexLabelPairs(self):
        numVertices = 6
        numFeatures = 1
        vList = VertexList(numVertices, numFeatures)
        vList.setVertices(numpy.array([numpy.arange(0, 6)]).T)

        graph = DenseGraph(vList, True)
        graph.addEdge(0, 1, 0.1)
        graph.addEdge(1, 3, 0.1)
        graph.addEdge(0, 2, 0.2)
        graph.addEdge(2, 3, 0.5)
        graph.addEdge(0, 4, 0.1)
        graph.addEdge(3, 4, 0.1)

        tol = 10**-6
        edges = graph.getAllEdges()

        X = GraphUtils.vertexLabelPairs(graph, edges)
        self.assertTrue(numpy.linalg.norm(X - edges) < tol )


        X = GraphUtils.vertexLabelPairs(graph, edges[[5, 2, 1], :])
        self.assertTrue(numpy.linalg.norm(X - edges[[5,2,1], :]) < tol )

        #Try a bigger graph
        numVertices = 6
        numFeatures = 2
        vList = VertexList(numVertices, numFeatures)
        vList.setVertices(numpy.random.randn(numVertices, numFeatures))

        graph = DenseGraph(vList, True)
        graph.addEdge(0, 1, 0.1)
        graph.addEdge(1, 3, 0.1)

        edges = graph.getAllEdges()

        X = GraphUtils.vertexLabelPairs(graph, edges)
        self.assertTrue(numpy.linalg.norm(X[0, 0:numFeatures] - vList.getVertex(1)) < tol )
        self.assertTrue(numpy.linalg.norm(X[0, numFeatures:numFeatures*2] - vList.getVertex(0)) < tol )
        self.assertTrue(numpy.linalg.norm(X[1, 0:numFeatures] - vList.getVertex(3)) < tol )
        self.assertTrue(numpy.linalg.norm(X[1, numFeatures:numFeatures*2] - vList.getVertex(1)) < tol )

        #Try directed graphs
        graph = DenseGraph(vList, False)
        graph.addEdge(0, 1, 0.1)
        graph.addEdge(1, 3, 0.1)

        edges = graph.getAllEdges()

        X = GraphUtils.vertexLabelPairs(graph, edges)
        self.assertTrue(numpy.linalg.norm(X[0, 0:numFeatures] - vList.getVertex(0)) < tol )
        self.assertTrue(numpy.linalg.norm(X[0, numFeatures:numFeatures*2] - vList.getVertex(1)) < tol )
        self.assertTrue(numpy.linalg.norm(X[1, 0:numFeatures] - vList.getVertex(1)) < tol )
        self.assertTrue(numpy.linalg.norm(X[1, numFeatures:numFeatures*2] - vList.getVertex(3)) < tol )
dataset/ETHPy150Open charanpald/APGL/apgl/graph/test/GraphUtilsTest.py/AbstractMatrixGraphTest.testVertexLabelPairs/original