While creating my pathfinding system for a 2D grid-based Map of nodes, I'm wondering if I can omit off having to pass the Map object as a parameter to all of my Node objects. That way, I can make my Map of nodes flexible and without having to worry about re-initializing all of my Nodes with the Map object all over again.
Given that there's a Node at position (X, Y), I was thinking of fetching its neighboring nodes, (X-1, Y-1), (X, Y-1), (X+1, Y-1), (X-1, Y), (X+1, Y), (X-1, Y+1), (X, Y+1), and (X+1, Y+1), without having to go search for it from the Map object. It turns out to be nearly impossible to do, since I don't have anything to refer to and make relative calculations based on (X, Y) alone.
Does anyone else know alternative methods of obtaining neighboring nodes from a specified Node position, without having to refer to a Map object containing all of the Nodes? If there are none, is that why I can't write off the reason for passing the Map object as a parameter to my Nodes?