def testHarmonicGeodesicDistance(self):
        numVertices = 5
        numFeatures = 1
        vList = VertexList(numVertices, numFeatures)
        graph = self.GraphType(vList)

        graph.addEdge(0, 1, 1)
        graph.addEdge(1, 2, 1)
        graph.addEdge(2, 3, 1)
        graph.addEdge(3, 4, 1)
        graph.addEdge(4, 0, 1)

        self.assertEquals(graph.harmonicGeodesicDistance(), 2.0)
        P = graph.floydWarshall(True)
        self.assertEquals(graph.harmonicGeodesicDistance(P), 2.0)

        #Test a string of vertices
        numVertices = 5
        numFeatures = 1
        vList = VertexList(numVertices, numFeatures)
        graph = self.GraphType(vList)

        graph.addEdge(0, 1, 1)
        graph.addEdge(1, 2, 1)
        graph.addEdge(2, 3, 1)
        graph.addEdge(3, 4, 1)

        self.assertAlmostEquals(graph.harmonicGeodesicDistance(), 180/77.0, places=5)
        P = graph.floydWarshall(True)
        self.assertAlmostEquals(graph.harmonicGeodesicDistance(P), 180/77.0, places=5)

        #Test case with isolated node
        numVertices = 5
        numFeatures = 1
        vList = VertexList(numVertices, numFeatures)
        graph = self.GraphType(vList)

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

        self.assertAlmostEquals(graph.harmonicGeodesicDistance(), 45/13.0, places=5)
        P = graph.floydWarshall(True)
        self.assertAlmostEquals(graph.harmonicGeodesicDistance(P), 13.0/45, places=5)

        #Totally empty graph
        graph = self.GraphType(vList)
        self.assertEquals(graph.harmonicGeodesicDistance(), float('inf'))

        #Test use of indices 
        graph = self.GraphType(vList)
        graph.addEdge(0, 1, 1)
        graph.addEdge(1, 2, 1)
        graph.addEdge(2, 3, 1)
        graph.addEdge(3, 4, 1)

        P = graph.floydWarshall(True)
        inds = [0, 4]
        self.assertEquals(graph.harmonicGeodesicDistance(vertexInds=inds), 12.0)

        #Test directed graph
        graph = self.GraphType(vList, False)

        graph.addEdge(0, 1, 1)
        graph.addEdge(1, 2, 1)
        graph.addEdge(2, 3, 1)
        graph.addEdge(3, 4, 1)

        P = graph.floydWarshall(True)
        self.assertAlmostEquals(graph.harmonicGeodesicDistance(P), 300/77.0, places=5)
dataset/ETHPy150Open charanpald/APGL/apgl/graph/test/MatrixGraphTest.py/MatrixGraphTest.testHarmonicGeodesicDistance/swapped operands of `/`