Dijkstra works for 3d