added the last method to dijkstra (tnx trev)