distance inputs of Dijkstra is changed to adapton version.