Graph Searching

Back to Tutorials.

Tutorial 1: Creating A New Graph

If at any point, you would like to reset the applet and restart the graph creation process from scratch, simply select 'Create New Graph' from the 'File' menu. If you have just started the applet, or started to create a new graph, the screen should look like the one shown below:


The applet automatically begins in the 'Create Node' submode, which you can see because it is the button that is depressed on the tool bar at the top of the window. If this button is depressed, then anytime you left click on the blank white canvas, a node will be created, and similarly for each button that is depressed. Each time a button is clicked, the message panel above the canvas displays a message giving you information of what you can do next. If you click on the canvas now the ' Node Properties' dialog box will open:


Enter a new name if you like, by typing it into the box beside the words 'Node Predicate'. You can also set the node's heuristics and set the node to either a goal node, start node or regular node. Click 'OK' to create the node or 'Cancel' to cancel the node creation.

Create a few more nodes if you like. To join them together, you will have to add edges. Click on the 'Create Edge' button. To begin creating an edge, click on a node. To place the other end of the edge, click on a different node. An 'Edge Properties' dialog box will open where you can set the edge's cost:


Click 'OK' to create the node or 'Cancel' to cancel the edge creation. After creating an edge you will now see an arrow between the two nodes, pointing from the first node to the second node.

If you would like to set the nodes heuristics to be the distance from the node to the goal node, go to the 'Search Options' menu and click on 'Set Node Heuristics Automatically'. If you would like to set the edge costs to be the distance from the two nodes the edge is on, go to the 'Search Options' menu and click on 'Set Edge Costs Automatically'. To view the node heuristics or edge costs on the graph, enable the "Show Node Heuristics" or "Show Edge Costs" check boxes under the view menu.

After creating a few more nodes and edges, your graph might look something like this:


To learn how to solve a graph, see Tutorial 3 on solving graphs.

Valid HTML 4.0 Transitional