def test_finding_correct_minimal_index_from_three_elements_third_step_zero_vert( self): graph_matrix = [[0, 2, 1], [2, 0, 3], [1, 3, 0]] graph = Graph(3, graph_matrix) dists = [0, 2, 1] visited_vert = {0, 2} self.assertTrue(graph.minimal_distance(dists, visited_vert) == 1)
def test_finding_correct_minimal_index(self): graph_matrix = [[0]] graph = Graph(1, graph_matrix) distances = [sys.maxsize] * 1 distances[0] = 0 visited_vert = set() self.assertTrue(graph.minimal_distance(distances, visited_vert) == 0)
def test_finding_correct_minimal_index_from_three_elements_zero_vert(self): graph_matrix = [[0, 2, 1], [2, 0, 3], [1, 3, 0]] graph = Graph(3, graph_matrix) distances = [0, sys.maxsize, sys.maxsize] visited_vert = set() self.assertTrue(graph.minimal_distance(distances, visited_vert) == 0)
def test_finding_correct_minimal_index_from_two_elements_second_step(self): graph_matrix = [[0, 2], [2, 0]] graph = Graph(2, graph_matrix) dists = [0, 2] visited_vert = {0} self.assertTrue(graph.minimal_distance(dists, visited_vert) == 1)
def test_finding_correct_minimal_index_from_two_elements(self): graph_matrix = [[0, 2], [2, 0]] graph = Graph(2, graph_matrix) dists = [0, sys.maxsize] visited_vert = set() self.assertTrue(graph.minimal_distance(dists, visited_vert) == 0)