示例#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))
示例#2
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]))
示例#3
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]))
示例#4
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()))