update before modifying or modyfing dijkstra algorithm