コード例 #1
0
ファイル: danker_test.py プロジェクト: Amula-CS/danker
 def test_right_sort(self):
     """
     Test if assert for right sort works (test with left sorted file)
     """
     link_file = "./test/graphs/test.links"
     danker_graph = danker.init(link_file, 0.1, True)
     with self.assertRaises(danker.InputNotSortedException):
         danker.danker_smallmem(danker_graph, link_file, 50, 0.85, 0.1)
コード例 #2
0
ファイル: danker_test.py プロジェクト: Amula-CS/danker
 def test_bar(self):
     """
     Test with a small graph (Bavarian Wikilinks) and comparision between danker and NetworkX.
     """
     link_file = "./test/graphs/bar-20190301.links"
     link_file_right = "./test/graphs/bar-20190301.links.right"
     nx_graph = nx.read_edgelist(link_file, create_using=nx.DiGraph, nodetype=int,
                                 delimiter='\t')
     nx_pr = nx.pagerank(nx_graph, tol=1e-8)
     danker_graph = danker.init(link_file, 0.1, False)
     danker_pr_big = danker.danker_bigmem(danker_graph, 50, 0.85)
     self._compare(nx_pr, danker_pr_big)
     danker_pr_small = danker.danker_smallmem(danker_graph, link_file_right, 50, 0.85, 0.1)
     self._compare(nx_pr, danker_pr_small)
コード例 #3
0
ファイル: danker_test.py プロジェクト: Amula-CS/danker
    def test_empty(self):
        """
        Test with an empty file
        """
        link_file = "./test/graphs/nill.links"
        link_file_right = "./test/graphs/nill.links.right"
        pathlib.Path(link_file).touch(exist_ok=True)
        pathlib.Path(link_file_right).touch(exist_ok=True)
        danker_graph = danker.init(link_file, 0.1, False)
        danker_pr_big = danker.danker_bigmem(danker_graph, 50, 0.85)
        danker_pr_small = danker.danker_smallmem(danker_graph, link_file_right, 50, 0.85, 0.1)
        self.assertEqual(len(danker_pr_big) + len(danker_pr_small), 0)

        # cleanup
        os.remove(link_file)
        os.remove(link_file_right)
コード例 #4
0
ファイル: danker_test.py プロジェクト: nadjet/danker
 def test_general(self):
     """
     Test with a very small graph and comparision between danker and NetworkX.
     """
     link_file = "./test/graphs/test.links"
     link_file_right = "./test/graphs/test.links.right"
     nx_graph = nx.read_edgelist(link_file,
                                 create_using=nx.DiGraph,
                                 nodetype=str,
                                 delimiter='\t')
     nx_pr = nx.pagerank(nx_graph, tol=1e-8)
     danker_graph = danker.init(link_file, 0.1, False, False)
     danker_pr_big = danker.danker_bigmem(danker_graph, 50, 0.85)
     self._compare(nx_pr, danker_pr_big)
     danker_pr_small = danker.danker_smallmem(danker_graph, link_file_right,
                                              50, 0.85, 0.1, False)
     self._compare(nx_pr, danker_pr_small)