Begin implementation of Dijkstra algorithm