Dijkstra algorithm for shortest path between words in some files