Very clean and understandable implementation, thanks for this!
I added a “DisableNode” method, which removes not only **all ** local connections from a node but also all connections, where this node is the destination, so no route can contain this node. Useful for moving obstacles, so you can take a node out of pathing with one line of code. This is especially important, as the current “RemoveNode” implementation in your code does not disconnect the node, so it’s removed from the graph, but their connections stay as ghosts, as they are. RemoveNode now also calls DisableNode to clean up the connections.
The difference between “DisableNode” and “RemoveNode” is, that with “Disable”, it stays in the graph, but does not have any connections, so for a map with moving objects, you may add all nodes when setting up your grid, and just connect/disable them as you need without creating new instances all the time through AddNode, when a map field becomes available again.
Contact me on discord, if you want the function for your implementation, or let me know, if I misunderstood anything in your code :-)
Cheers, Gris