Algorithm for node generation for pathfinding. Dijkstra and A* attached.