iOS dijkstra algorithm