The code is fully typed and makes use of composition with Protocol classes so that valid directions, traversal strategies, and even 2D graph types can be readily exchanged with minimal refactoring.