adding the initial dijkstras algorithm