updated compute shortest path