Elixir rewrite of A* graph pathfinding