Objective:

Graphs are one of the most versatile structures used in computer programming. In this lab, we discuss the algorithms associated with weighted graphs.

At the end of this lab, you need to submit a word document including some text answers and screenshots of your lab result. The way to get the screen shots is to press Key "Print Screen" rom your keyboard to get the image of the whole screen, then use Start->All Programs->Accessories->Paint, click Edit->Paint to get the image, use text "A" to add your own name (to replace "Qi Zhu"), then cut and paste the part of image you want into your homework file such as .doc).

1. Operations on GraphN.html

(1.) Click Start -> Windows System -> Command Prompt. Use command "cd" to move into the directory where you run the applet, such as "cd C:\COSC3333\Chap14\GraphW". Then use the command "appletviewer GraphW.html" to run the application, see Figure 1. see image.

(2.) Use Double-click to create new vertex, enter the weights in the blank of Enter number, and Drag from vertex to vertex to create edge, we have Figure 2. Q1: How many vertices in this graph, how many edges in this graph? see image.

(3.) Click View to show the adjacency matrix of this graph, we have Figure 3. Click View again to switch it back. see image.

(4.) Click Tree to run the algorithm of finding the minimal spanning tree for this tree starting from vertex A, finally you have Figure 4. Q2: What is the visiting sequence for all the vertices? Q3: What is the set of edges for the minimum spanning tree? What is the total weights of this minimum spanning tree? see image.

2. Operations on GraphDW.html

(1.) Change directory by type the command "cd ..\GraphDW", then use the command "appletviewer GraphDW.html" to run the application, see Figure 5. see image.

(2.) Use Double-click to create new vertex, enter the weights in the blank of Enter number, and Drag from vertex to vertex to create edge, we have Figure 6. see image.

(4.) Click View to show the adjacency matrix of this graph, we have Figure 7. Click View again to switch it back. see image.

(5.) Click Path to run the algorithm of shortest path starting from point A, finally you have Figure 8. Q4: What is the shortest path from A to F? What is the minimal distance from A to F? see image.

Part I: Answer the questions:

Q1: How many vertices in this graph, how many edges in this graph?

Q2: What is the visiting sequence for all the vertices?

Q3: What is the set of edges for the minimum spanning tree? What is the total weights of this minimum spanning tree?

Q4: What is the shortest path from A to F? What is the minimal distance from A to F?

Part II: Screen shots

Submit the screenshots for Figure 2 to Figure 4 and Figure 6 to 8 (totally 6 figures) through Blackboard. (Dont forget to include your name in the program). (At the end of this lab, you need to submit a word document including some screenshots of your lab result. The way to get the screen shots is to press Key "Print Screen" from your keyboard to get the image of the whole screen, then use Start -> All Programs -> Accessories -> Paint, click Edit -> Paint to get the image, use text "A" to add your own name (to replace "Qi Zhu"), then cut and paste the part of image you want into your homework file such as .doc).

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.