Пример #1
0
    def test_pool(self):
        g = nx.karate_club_graph()

        # Louvain
        resolution = ensemble.Parameter(name="resolution", start=0.1, end=1, step=0.1)
        randomize = ensemble.BoolParameter(name="randomize")
        louvain_conf = [resolution, randomize]

        # Angel
        threshold = ensemble.Parameter(name="threshold", start=0.1)
        angel_conf = [threshold]

        methods = [algorithms.louvain, algorithms.angel]

        for communities in ensemble.pool(g, methods, [louvain_conf, angel_conf]):
            self.assertIsInstance(communities.communities, list)
    def test_pool(self):
        g = nx.karate_club_graph()

        # Louvain
        resolution = ensemble.Parameter(name="resolution",
                                        start=0.1,
                                        end=1,
                                        step=0.1)
        # randomize = ensemble.BoolParameter(name="randomize")
        louvain_conf = [resolution]

        # Demon
        epsilon = ensemble.Parameter(name="epsilon", start=0.1)
        demon_conf = [epsilon]

        methods = [algorithms.louvain, algorithms.demon]

        for communities in ensemble.pool(g, methods,
                                         [louvain_conf, demon_conf]):
            self.assertIsInstance(communities.communities, list)