def evaluate_tar_troj_time(self): """ Computes the time for the tarjan and trojanowsi's algorithm """ start = time() Ec = complement(self.__V, self.__E) maxset(self.__V, Ec) end = time() self.__tar_troj_time = round(end - start, 4)
def test_degree0(self): for i in range(3): V, E = generate_graph_of_degree(0) Ec = complement(V, E) expected = len(naive(V, Ec)) actual = maxset(V, E) self.assertEqual(expected, actual)
def test_random_graph(self): for i in range(3): V, E = generate_random_graph() Ec = complement(V, E) expected = len(naive(V, Ec)) actual = maxset(V, E) self.assertEqual(expected, actual)
def test_ST_3_2(self): V = {1, 2, 3, 4, 5} E = [{1, 3}, {2, 4}, {2, 3}, {4, 5}, {2, 5}, {1, 2}, {1, 4}, {3, 5}] X = maxset(V, E) self.assertEqual(X, 2)
def test_ST_2_1(self): X = maxset({1, 2, 3}, [{1, 2}, {1, 3}, {2, 3}]) self.assertEqual(X, 1)
def test_ST_1(self): X = maxset({1, 2}, [{1, 2}]) self.assertEqual(X, 1)
def test_DEG_0(self): X = maxset({1, 2, 3}, []) self.assertEqual(X, 3)
def test_empty(self): X = maxset(set(), []) self.assertEqual(X, 0)