예제 #1
0
    def testFindSingleSimilarityPathSimExampleThree(self):
        """
          Tests pairwise similarity for nodes, using example 3 from PathSim paper (compute similarity scores from Mike)
        """

        graph, authorMap, conferenceMap  = SampleGraphUtility.constructPathSimExampleThree()
        metaPath = [Author, Paper, Conference, Paper, Author]
        strategy = PathSimStrategy(graph, metaPath)

        mike = authorMap['Mike']
        jimScore, maryScore, bobScore, annScore = strategy.findSimilarityScores(
            mike, [authorMap['Jim'], authorMap['Mary'], authorMap['Bob'], authorMap['Ann']]
        )

        self.assertEquals(bobScore, max([jimScore, maryScore, bobScore, annScore]))
        self.assertEquals(annScore, 0)
예제 #2
0
    def testFindSingleSimilarityPathSimExampleThree(self):
        """
          Tests pairwise similarity for nodes, using example 3 from PathSim paper (compute similarity scores from Mike)
        """

        graph, authorMap, conferenceMap = SampleGraphUtility.constructPathSimExampleThree(
        )
        metaPath = [Author, Paper, Conference, Paper, Author]
        strategy = PathSimStrategy(graph, metaPath)

        mike = authorMap['Mike']
        jimScore, maryScore, bobScore, annScore = strategy.findSimilarityScores(
            mike, [
                authorMap['Jim'], authorMap['Mary'], authorMap['Bob'],
                authorMap['Ann']
            ])

        self.assertEquals(bobScore,
                          max([jimScore, maryScore, bobScore, annScore]))
        self.assertEquals(annScore, 0)