def IDS2(self): frontier = PriotyQueue(self.n) limit = 0 while True: depth = 0 explored = [] frontier.add(((self.source, ), depth)) while frontier.empty() == False: pop_pair = frontier.pop() path = pop_pair[0] depth = pop_pair[1] node = path[-1] explored.append(node) if node == self.des: print(explored) self.returnPath = path[::-1] self.expanded = explored return for i in range(len(self.matrix)): if (self.matrix[node][i] != 0 and i != path[len(path)-2]): level = depth - 1 if (abs(level) <= limit): newPath = path + (i, ) frontier.add((newPath, level)) limit += 1 frontier.frontier.clear() print(explored)