Operation/User’s Manual

Loading the Applet

To load the applet, first ensure you have the latest version of the java SDK installed on your computer. The latest version can always be downloaded from Sun’s web site. As of November 2008, the latest version is Version 6 Update 10, and this manual will assume the reader has installed this version.

Next, open a browser window, and go to my applet site. After Java loads, the applet will appear. I will assume the reader is using Internet Explorer for the remainder of these instructures because it is (unfortunately) the most common browser in the world today. I have tested the applet using the Firefox and Chrome browsers, too, and found that the applet works well despite browser differences.

Once loaded, your window will look something like this:

no-graph-loaded.jpg

Executing the Applet

The applet consists of seven major user interface components, and this section will describe each briefly. Refer to the following figure or follow along with the applet as each part is described.

legend.jpg

Applet Status

This label will display status regarding the applet. For example, when the applet starts, it will display “Ready to optimize graphs...” It will also flash errors or status, such as “Access denied to URL” or “Solved.”

Graph Box

This box displays the graph and its solution. The vertices are displayed using colors that represent their weights. “Heavy” weights are shown reddish, and “light” weights are shown blueish. The vertices are drawn in a circle around the center of the box, and they are scaled based on the number of vertices in the graph. When there are many vertices, the circles are drawn small. When there are few vertices, the circles are drawn large, and the actual weights of the vertices are drawn inside them.

Gray lines connect some of the vertices, and these represent the possible edges of the graph. When the graph is solved, the edges that are in the solution are drawn with a thick, bright red line. Also when the graph is solved, the root node is displayed with a circle around it as it can be seen in the figure above in which the vertex at index 5 with weight 5 is the root.

Scale of Vertex Weights

The scale shown on the right of the Graph Box displays the range of weights in the graph. The vertices with the largest weights are shown in red, and the vertices with the smallest weights are shown in blue. The remaining weights are shown in a color somewhere between these two extremes. The largest and smallest weights are displayed at the top and the bottom of the scale, respectively.

Solution Information

This area of the Graph Box displays information about the graph and its solution. It displays the number of vertices, the number of edges, and when the graph is solved, it displays the root index and the overall weight of the solution.

To the left of the solution information is an icon, info.png, and when it is clicked, a popup window will appear that provides even greater detail about the graph. In the popup window, shown below, all information about the graph and its solution are displayed in a text box.

graph-details.jpg

URL Text Box

This text box is used to enter a URL for a graph to download. It is important to know that the URL must be valid, and the URL must be accessible by the java applet. Java applets run with several restrictions, and one is that the graph specified by the URL must exist on the same server as the applet. This means the applet cannot download a graph from another server like http://www.google.com.

Download Button

When clicked, the download button will start a background thread that will download the URL specified in the URL Text Box. If the URL is valid, the graph will be solved and displayed in the Graph Box. If the URL is invalid, the graph is inaccessible, or the graph is corrupt, an error message will appear for a few seconds in the Applet Status.

While the graph is downloaded and solved, the URL Text Box, the Download Button, and the Randomize Button will be disabled. Once the graph is solved, they are re-enabled.

Randomize Button

When clicked, the randomize button will start a background thread that solves a (pseudo) randomly generated graph. The graph and its solution will be displayed in the Graph Box. The graph generated will contain between two and thirty-two vertices, weights that range from 1 to 99, and some number of loops (25% of the available connections in the adjacency matrix).

While the graph is being solved, the URL Text Box, the Download Button, and the Randomize Button will be disabled. Once the graph is solved, they are re-enabled.

Advanced Function

It is possible to automatically load and solve a graph by specifying a parameter in the URL for the applet. The applet looks at the “url” HTML “get” parameter, and if it is present, it uses its value as the default URL. If the URL is not present, it defaults to point to a sample graph on my site.

For example, specifying a URL like the following will automatically download and solve a graph named sample.graph from my ics311/hw2/graphs directory.

http://www.jade-cheng.com/uh/coursework/ics-311/assignment-2/applet?url=http://www.jade-cheng.com/uh/coursework/ics-311/assignment-2/operation/sample.graph

This feature is especially useful when testing the applet. More of this is discussed in my testing documentation.

Another special feature of the applet is animation. For “small” graphs, graphs with six or fewer vertices, the graph will animate the solution as can be seen in the following movie.

You need Flash Player 9 and a browser with javascript to view this video.

Links

Valid HTML 4.01 Valid CSS