def testTriangleSequence(self):
        tol = 10**-6
        numVertices = 5
        numFeatures = 0
        vList = VertexList(numVertices, numFeatures)

        graph = self.GraphType(vList, True)

        seq = graph.triangleSequence()
        self.assertTrue(numpy.linalg.norm(seq - numpy.array([0, 0, 0, 0, 0])) < tol)

        graph.addEdge(0, 1)
        graph.addEdge(0, 2, 0.1)
        graph.addEdge(1, 2)

        seq = graph.triangleSequence()
        self.assertTrue(numpy.linalg.norm(seq - numpy.array([2, 2, 2, 0, 0])) < tol)

        graph.addEdge(2, 3)
        graph.addEdge(3, 0, -0.3)

        seq = graph.triangleSequence()
        self.assertTrue(numpy.linalg.norm(seq - numpy.array([4, 2, 4, 2, 0])) < tol)

        graph.removeAllEdges()
        graph.addEdge(0, 0)
        seq = graph.triangleSequence()
        self.assertTrue(numpy.linalg.norm(seq - numpy.array([0, 0, 0, 0, 0])) < tol)

        #Test on directed graphs
        graph = self.GraphType(vList, False)
        graph.addEdge(0, 1)
        graph.addEdge(1, 2, 0.1)
        graph.addEdge(2, 0)

        seq = graph.triangleSequence()
        self.assertTrue(numpy.linalg.norm(seq - numpy.array([1, 1, 1, 0, 0])) < tol)

        graph.addEdge(0, 3)
        graph.addEdge(3, 4, 0.1)
        graph.addEdge(4, 0)

        seq = graph.triangleSequence()
        self.assertTrue(numpy.linalg.norm(seq - numpy.array([2, 1, 1, 1, 1])) < tol)
dataset/ETHPy150Open charanpald/APGL/apgl/graph/test/MatrixGraphTest.py/MatrixGraphTest.testTriangleSequence/original