working serial dijkstra