Add functionality for shortest path calculation.