diff options
-rw-r--r-- | 2019/20.hs | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -23,7 +23,9 @@ shortestPath nextf heuristic startnode target = go 0 (Set.singleton (heuristic s visited' = Map.insert node dist visited in if node == target then dist - else go (ctr + 1) pqueue' visited' + else if maybe True (dist <) (Map.lookup node visited) + then go (ctr + 1) pqueue' visited' + else go (ctr + 1) newpqueue visited main :: IO () main = do |