pathDijkstra :: Dijkstra -> Vertex -> Maybe Path
pathDijkstra (Dijkstra prev) goal =
    case searchBackwards goal of
      [_] -> Nothing
      path -> Just (Path $ (tail . reverse) path)
    where
      searchBackwards goal' = goal' : maybe [] searchBackwards (M.lookup goal' prev)
pathDijkstra :: Dijkstra -> Vertex -> Maybe Path
pathDijkstra (Dijkstra prev) goal =
    case searchBackwards goal of
      [_] -> Nothing
      path -> Just (Path $ (tail . reverse) path)
    where
      searchBackwards goal' = goal' : maybe [] searchBackwards (M.lookup goal' prev)
pathDijkstra (Dijkstra prev) goal =
    case searchBackwards goal of
      [_] -> Nothing
      path -> Just (Path $ (tail . reverse) path)
    where
      searchBackwards goal' = goal' : maybe [] searchBackwards (M.lookup goal' prev)