In this exercise you will use the graph representation framework and graph search implementation to represent and solve the farmer, wolf, goat, and cabbage (FWGC) problem introduced in the graphs lecture.
Here is a zipped NetBeans project to use for this lab: CS_2511_Graph_Search.zip.

Unzip this file and open the resulting CS_2511_Graph_Search NetBeans project.

Three source packages are used:
Two files under Test Packages are used in this lab.
Your job is to complete the FarmerGraph class so that when the FarmerGraphTest class is run, it produces the output shown to the right.
This lab is accomplished by completing the FarmerGraph class, using ExampleGraph as a model.
The graph.ExampleGraph class under Source Packages, shown to the right, represents the graph pictured below:

Note:

The graph.ExampleGraphTest class under Test Packages, shown to the right, produces the output below by:
The farmer.FarmerGraphTest class under Test Packages, shown to the right, is entirely analogous to graph.ExampleGraphTest and should produce the output below.
The farmer.FarmerGraph class under Source Packages, shown to the right, must be completed to represent the graph pictured below:

The vertices in this graph are FarmerState objects:

To complete FarmerGraph, you must thoroughly understand ExampleGraph.

However, since the FarmerGraphTest displays actual FarmerState objects in its search results, the construction of FarmerGraph vertices is slightly different.

ExampleGraph vertices are created by constructing SimpleVertex objects with simple names, as in:

     private Vertex r;
     ...
     r = new SimpleVertex("r");
        
FarmerGraph vertices must be FarmerState objects, so they must be constucted by, for example:
     private Vertex v1;
     ...
     v1 = new FarmerState("west", "west", "west", "west"); // the start state
        
This works because the FarmerState class extends the graph.SimpleVertex class.

Finally, in order for FarmerGraphTest to print the FarmerGraph adjacency lists with simple names, the vertices must be given these names after creation, for example:

     v1.setName("1");
        
When finished, zip your project folder as your-login-LEX8.zip.

Email the zip file to your TA.