Trying to find the shortest path to each node