def __init__(self, size): self.weightMatrix = WeightMatrix(size) self.start = random.randint(0, self.weightMatrix.size - 1) self.finish = random.randint(0, self.weightMatrix.size - 1) self.accessibleNode = [] self.weightNode = [] self.nodes_list = [] self.weight_way = 0 self.initialization()
from algos.DijkstraAlgorithm import DijkstraAlgorithm from matrices.Dijkstra_Matrices import Dijkstra_Matrices from matrices.WeightMatrix import WeightMatrix __author__ = 'azank' test_algorithm = DijkstraAlgorithm() matrices = Dijkstra_Matrices() """ Tests """ test_algorithm.dijkstra(matrices.matrix_one) print(test_algorithm.test_result(matrices.matrix_one_expected)) test_algorithm.dijkstra(matrices.matrix_two) print(test_algorithm.test_result(matrices.matrix_two_expected)) test_algorithm.dijkstra(matrices.matrix_three) print(test_algorithm.test_result(matrices.matrix_three_expected)) """ Test on random matrix """ print("Test on random matrix") matrix = WeightMatrix(5) test_algorithm.dijkstra(matrix.apex)