For performance reasons, we made the field non-final.
We should further encapsulate the field to prevent abuse.
visitedNodes is protected and reset() now reassigns it instead of clearing. Any subclass (including external users) that cached a reference to the map (or passes it elsewhere) will observe stale state after reset(), which is a behavioral/API change from the previous clear() behavior. If reassignment is required for performance, consider encapsulating the map (e.g., make it private and expose protected helper methods) so subclasses cannot retain aliases, or keep clearing semantics.
Originally posted by @Copilot in #1641
For performance reasons, we made the field non-final.
We should further encapsulate the field to prevent abuse.
Originally posted by @Copilot in #1641