Added a function for finding shortest path
between two nodes.