Started implementing the shortest path function