Esempio n. 1
0
    def check_path(self, e):
        tar = e.target()
        sou = e.source()
        target_distance = self.distance[tar]
        current_distance = self.distance[sou] + 1

        if target_distance == 0 or target_distance > 0 and current_distance < target_distance:
            self.predecessor[tar] = sou
            self.distance[tar] = current_distance
            self.edge[tar] = self.graph.edge_index[e]

        if not self.found and self.target and self.target == tar:
            self.found = tar
            raise gt.StopSearch()
        elif not self.found and self.targetf and self.targetf(
                tar, self.get_path_nodes):
            self.found = tar
            raise gt.StopSearch()
Esempio n. 2
0
 def edge_relaxed(self, e):
     if e.target() == self.target:
         raise gt.StopSearch()
Esempio n. 3
0
 def edge_relaxed(self, e):
     if self.state[e.target()] == self.target:
         self.visited[tuple(self.target)] = e.target()
         raise gt.StopSearch()