Below is an ExampleGraphTest class that tests the ExampleGraph class.

It runs breadth-first and depth-first searches on the graph. If you have not yet started the Graph Search and Creation module, that's OK. It's enough to know that a side effect of these searches is the linking of vertices through their predecessor fields.

These links can be used to access a resulting predecessor tree and construct solutions to problems.

Consider the maze application below. It shows the problem solver with a solving capability and a choice of BFS or DFS.

A breadth-first search of maze 1 finds an optimal path of 28 moves.

A depth-first search of maze 1 finds a sub-optimal path of 112 moves.

Here is another maze problem, with barriers.

A breadth-first search of maze 2 finds an optimal path of 26 moves.

A depth-first search of maze 2 finds a sub-optimal path of 104 moves.