working Dijkstra implemented