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))
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]))
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))
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]))
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()))
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))
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))
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))