def test_find_bipartite_3(self): g = Graph({1: [2, 3], 4: [2, 3, 5], 5: [6, 7, 8], 7: [9]}) a, b = find_bipartite(g) if len(a) > len(b): a, b = b, a self.assertEqual(b, [1, 4, 6, 7, 8]) self.assertEqual(a, [2, 3, 5, 9]) self.assertTrue(is_bipartite(g))
def test_find_bipartite_2(self): g = Graph({5: [1, 2, 3]}) a, b = find_bipartite(g) if len(a) > len(b): a, b = b, a self.assertEqual(a, [5]) self.assertEqual(b, [1, 2, 3]) self.assertTrue(is_bipartite(g))
def test_is_bipartite_6(self): g = Graph({1: [2]}) self.assertTrue(is_bipartite(g))
def test_is_bipartite_5(self): g = Graph({1: [], 2: []}) self.assertTrue(is_bipartite(g))
def test_is_bipartite_4(self): g = Graph({1: [2, 3], 2: [3]}) self.assertFalse(is_bipartite(g))
def test_is_bipartite_3(self): g = Graph({1: [2, 3], 4: [2, 3]}) self.assertTrue(is_bipartite(g))
def test_is_bipartite_2(self): g = Graph({5: [1, 2, 3]}) self.assertTrue(is_bipartite(g))
def test_is_bipartite_1(self): g = Graph({5: []}) self.assertFalse(is_bipartite(g))