Пример #1
0
    def test_girvan(self):
        """
        Generate ground truth graph with 4 communities.
        Test that infomap detects them correctly
        """
        graph = girvan_graphs(4)
        modules = infomap.get_best_module(graph)

        for node, module in modules.items():
            self.assertEqual(module, modules[node%4])
    def test_girvan(self):
        """
        Generate ground truth graph with 4 communities.
        Test that infomap detects them correctly
        """
        graph = girvan_graphs(4)
        modules = infomap.get_best_module(graph)

        for node, module in modules.items():
            self.assertEqual(module, modules[node % 4])
Пример #3
0
    def test_karate_club_graph(self):
        graph   = nx.karate_club_graph()
        result = infomap.get_best_module(graph)
        len_res = get_result_len(result.values())

        self.assertEqual(len_res, 3)
Пример #4
0
    def test_simple_graph(self):
        graph  = btg.build_graph()
        result = infomap.get_best_module(graph)
        len_res = get_result_len(result.values())

        self.assertEqual(len_res, 2)
    def test_karate_club_graph(self):
        graph = nx.karate_club_graph()
        result = infomap.get_best_module(graph)
        len_res = get_result_len(result.values())

        self.assertEqual(len_res, 3)
    def test_simple_graph(self):
        graph = btg.build_graph()
        result = infomap.get_best_module(graph)
        len_res = get_result_len(result.values())

        self.assertEqual(len_res, 2)