示例#1
0
    def test_with_different_nodes(self):
        for i in range(1, 11):
            self.tree.add_node(i, w=i)

        self.assertEqual(max_independent_set(self.tree, 1), (35, {4, 6, 7, 8, 10}))
示例#2
0
 def test_with_one_and_only(self):
     t = Graph()
     t.add_node(1, p=1256)
     self.assertEqual(max_independent_set(t, 1, weight_attribute="p"), (1256, {1}))
示例#3
0
    def test_with_equal_nodes(self):
        for i in range(1, 11):
            self.tree.add_node(i, w=2)

        self.assertEqual(max_independent_set(self.tree, 1), (10, {1, 5, 6, 8, 9}))