def test_return_empty(self):
     actual = charikar_algo(self.g1, R,
                            [A, B, C, D, E],
                            100, 1)
     assert_equal([],
                  actual.edges()
              )
 def check_level(self, level, edges, k=5, root=R, X=[A, B, C, D, E]):
     actual = charikar_algo(self.g1, root,
                            X,
                            k, level)
     assert_equal(sorted(edges),
                  sorted(actual.edges())
     )
Exemple #3
0
    def test_bs_ensure_result_is_tree(self):
        params = pkl.load(
            open(make_path('test/data/quota_test_cases/params.pkl')))[0]

        root = params['roots'][0]
        preprune_secs = params['preprune_secs']
        mg = IU.get_topic_meta_graph_from_synthetic(
            make_path('test/data/quota_test_cases/interactions.json'),
            preprune_secs)
        dag = IU.get_rooted_subgraph_within_timespan(mg, root, preprune_secs)
        t = charikar_algo(dag, root, dag.nodes(), k=20, level=2)
        assert_true(nx.is_arborescence(t))
    def test_bs_ensure_result_is_tree(self):
        params = pkl.load(
            open(make_path('test/data/quota_test_cases/params.pkl'))
        )[0]

        root = params['roots'][0]
        preprune_secs = params['preprune_secs']
        mg = IU.get_topic_meta_graph_from_synthetic(
            make_path('test/data/quota_test_cases/interactions.json'),
            preprune_secs            
        )
        dag = IU.get_rooted_subgraph_within_timespan(
            mg, root, preprune_secs
        )
        t = charikar_algo(dag, root, dag.nodes(),
                          k=20, level=2)
        assert_true(nx.is_arborescence(t))
Exemple #5
0
 def test_return_empty(self):
     actual = charikar_algo(self.g1, R, [A, B, C, D, E], 100, 1)
     assert_equal([], actual.edges())
Exemple #6
0
 def check_level(self, level, edges, k=5, root=R, X=[A, B, C, D, E]):
     actual = charikar_algo(self.g1, root, X, k, level)
     assert_equal(sorted(edges), sorted(actual.edges()))