コード例 #1
0
    def test_lemon(self):
        g = get_string_graph()
        seeds = ["$0$", "$2$", "$3$"]
        com = algorithms.lemon(g, seeds, min_com_size=10, max_com_size=50)
        self.assertEqual(type(com.communities), list)
        if len(com.communities) > 0:
            self.assertEqual(type(com.communities[0]), list)
            self.assertEqual(type(com.communities[0][0]), str)

        g = nx.karate_club_graph()
        seeds = [0, 2, 3]
        com = algorithms.lemon(g, seeds, min_com_size=10, max_com_size=50)
        self.assertEqual(type(com.communities), list)
        if len(com.communities) > 0:
            self.assertEqual(type(com.communities[0]), list)
            self.assertEqual(type(com.communities[0][0]), int)
コード例 #2
0
 def lemon(seeds, min_com_size, max_com_size) : return lambda G : algorithms.lemon(G, seeds=seeds, min_com_size=min_com_size, max_com_size=max_com_size)
 seeds = [1, 2, 3]