dijkstra's algorithm tested (works)