Ejemplo n.º 1
0
 def test_edge_contraction_seed_1(self):
     graph_test = {1: [3], 3: [1]}
     graph = min_cut.read_input_data('test.txt', 3)
     v = min_cut.choose_random_vertex(1, graph.keys())
     e = min_cut.choose_random_edge(1, graph[v])
     self.assertEqual(graph_test, min_cut.edge_contraction(v, e, graph))
Ejemplo n.º 2
0
 def test2_choose_random_edge_seed_0(self):
     graph = min_cut.read_input_data('test2.txt', 10)
     v = min_cut.choose_random_vertex(2, graph.keys())
     print graph
     self.assertEqual(8, min_cut.choose_random_edge(2, graph[v]))
Ejemplo n.º 3
0
 def test_read_input_data(self):
     graph1 = {1: [2, 3], 2: [1], 3: [1]}
     self.assertEqual(graph1, min_cut.read_input_data('test.txt', 3))
Ejemplo n.º 4
0
 def test_choose_random_edge_seed_1(self):
     graph = min_cut.read_input_data('test.txt', 3)
     v = min_cut.choose_random_vertex(1, graph.keys())
     print graph
     self.assertEqual(1, min_cut.choose_random_edge(1, graph[v]))
Ejemplo n.º 5
0
 def test_random_vertex_seed_1(self):
     graph = min_cut.read_input_data('test.txt', 3)
     self.assertEqual(2, min_cut.choose_random_vertex(1, graph.keys()))
Ejemplo n.º 6
0
 def test2_min_cut_seed_0(self):
     graph = min_cut.read_input_data('test2.txt', 10)
     self.assertEqual(2, min_cut.minimum_cut(0, graph))
Ejemplo n.º 7
0
 def test_min_cut_seed_1(self):
     graph = min_cut.read_input_data('test.txt', 3)
     self.assertEqual(1, min_cut.minimum_cut(1, graph))
Ejemplo n.º 8
0
 def test_read_input_data_bad_num(self):
     graph2 = {
         1: [2, 3],
         2: [1],
     }
     self.assertEqual(graph2, min_cut.read_input_data('test.txt', 2))