Working doubleDijkstra algorithm -TH