Add shortest_path method to Graph.