Implementation of Dijkstra’s shortest path algorithm