Instructions for the Hamiltonian Graph Tool

These instructions will allow you to create customized graph theory problems within the directory MyExercises provided in the zipped file Download this file and unzip it in a location where you can easily find the files and folders. Here you will find all of the files on this website along with the MyExercises folder and the Flash source code for these tools.

Step 1

Click here to open the instructor's "GraphMakerHamilton" tool in its own window. Print these instructions or resize things to be able to see these instructions and the GraphMakerHamilton tool at the same time.

Step 2

Open the file "hamilton.xml" within the MyExercises directory. You will see the following lines:

<?xml version="1.0"?>




The number 0 between the <NumberToUse> and </NumberToUse> indicates that all of the graphs in this file will be used. To specify that a subset of the total should be used, change this to the number of graphs you would like to be part of your problem set.

Initially there is no data between the <graph> and </graph> tags. This is where we will place the data that specifies our graphs. Leave this file open and return to the GraphMakerHamilton tool.

Step 3

Follow the instructions in GraphMakerHamilton to draw a graph that you want your students to search for hamiltonian trails or circuits. A quick reference for the functions available appears below. After the graph is formed, the student interace will shrink the scale slightly so that labels can be added automatically. It is strongly recommended that you preview the labeled graph in the student interface before quitting the HamiltonGraphMaker tool.

  1. When RemoveNodes, DrawNodes, or EditLines buttons are pressed, you activate/deactivate a mode with specific editing abilities. You will be able to tell that mode is active by the gray box that appears behind the relevant button.
    • When DrawNodes is active, clicking on the screen will produce a node. Once the maximum allowable number of nodes is reached, you will be "cut off" from this function.
    • When RemoveNodes is active, clicking on a node will delete it along with any incident edges.
    • When EditLines is active, clicking on a pair of nodes will either draw an edge between them or remove the edge between them if an edge is already there.
    • When none of this buttons is active, you can freely drag nodes to rearrange your graph.
  2. The Clear button erases your graph so you can start over.
  3. The Finished button leaves the editor and shows you the data that defines your graph.

Step 4

The data for your graph is shown in a text box in the middle of the screen. Use your mouse (or click in the box and press Ctrl+A to "Select All") to select all text that is there, and press "Ctrl+C" to copy it. Go to the still-open file hamilton.xml, and paste (Ctrl+V) this line of data between the tags <graph> and </graph>.) Note that you can then start over building another graph or you can return to edit the one you just copied to the text file. You should make sure that a graph looks okay in the student interface before starting to build a new graph.

When adding more graphs to the hamilton.xml file, you will need to type your own <graph> and </graph> tags. Do not put any space between the tags and the graph data!

Step 5

Test your exercises by opening the file HamiltonGraphsXML.html in your browser. You will notice that the problems are given in random order. Note that you can include more instructions or information before and/or after the actual Flash applet, if desired.

A note on the source code

If you do not want to use the name "hamilton.xml" for your data file, you can change this in the script of the first frame of the HamiltonGraphsXML.fla source file. Note that you must have the Flash authoring system to make this change.


Go back to the overview

Proceed to a sample activity for students

Comments and questions should be directed to Doug Ensley at