shortest path between two nodes in a graph