def testMaxProductPaths(self):
        numVertices = 6
        numFeatures = 1
        vList = VertexList(numVertices, numFeatures)

        graph = self.GraphType(vList)
        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)

        P = graph.maxProductPaths()

        P2 = numpy.zeros((numVertices, numVertices))
        P2[0, :] = numpy.array([0.04, 0.1, 0.2, 0.1, 0.1, 0])
        P2[1, :] = numpy.array([0.1, 0.01, 0.05, 0.1, 0.01, 0])
        P2[2, :] = numpy.array([0.2, 0.05, 0.25, 0.5, 0.05, 0])
        P2[3, :] = numpy.array([0.1, 0.1, 0.5, 0.25, 0.1, 0])
        P2[4, :] = numpy.array([0.1, 0.01, 0.05, 0.1, 0.01, 0])
        P2[5, :] = numpy.array([0,0,0,0,0,0])

        self.assertAlmostEquals(numpy.linalg.norm(P - P2), 0, places=6)

        #Now test on a directed graph
        graph = self.GraphType(vList, False)
        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)

        P = graph.maxProductPaths()

        P2 = numpy.zeros((numVertices, numVertices))
        P2[0, :] = numpy.array([0, 0.1, 0.2, 0.1, 0.1, 0])
        P2[1, :] = numpy.array([0, 0, 0, 0.1, 0.01, 0])
        P2[2, :] = numpy.array([0, 0, 0, 0.5, 0.05, 0])
        P2[3, :] = numpy.array([0, 0, 0, 0, 0.1, 0])
        P2[4, :] = numpy.array([0,0,0,0,0,0])
        P2[5, :] = numpy.array([0,0,0,0,0,0])

        self.assertAlmostEquals(numpy.linalg.norm(P - P2), 0, places=6)
dataset/ETHPy150Open charanpald/APGL/apgl/graph/test/MatrixGraphTest.py/MatrixGraphTest.testMaxProductPaths/original