コード例 #1
0
ファイル: benchmark.py プロジェクト: TravisPetit/GA
 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)
コード例 #2
0
 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)
コード例 #3
0
 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)
コード例 #4
0
 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)
コード例 #5
0
 def test_ST_2_1(self):
     X = maxset({1, 2, 3}, [{1, 2}, {1, 3}, {2, 3}])
     self.assertEqual(X, 1)
コード例 #6
0
 def test_ST_1(self):
     X = maxset({1, 2}, [{1, 2}])
     self.assertEqual(X, 1)
コード例 #7
0
 def test_DEG_0(self):
     X = maxset({1, 2, 3}, [])
     self.assertEqual(X, 3)
コード例 #8
0
 def test_empty(self):
     X = maxset(set(), [])
     self.assertEqual(X, 0)