Dijkstra algorithm works with disconnected graphs