

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


CSC 3102 Programming Assignment 4 Exploring Graph Functions Due: December 3, Thursday (by class time) Points: 5 Submit your work as instructed towards the end of this document. Contact TA Di Lin by e- mail to [email protected] or me by e-mail to [email protected] for help. Late submission is not allowed. Objective: To demonstrate the various functions and problems related to graphs. Background: You have learned about various interesting functions and problems related to graph. They include single-source shortest path, topological sorting, DFS and BFS graph traversals, minimum spanning tree and transitive closure. The given menu-driven application allows you to solve these graph problems. The menu interface is as follows: BASIC WEIGHTED GRAPH APPLICATION ================================== [1] Adjacency Matrix [2] Transitive Matrix [3] Single-source Shortest Path [4] Perform DFS Traversal [5] Perform BFS Traversal [6] Current number of edges [7] Topological Sort Labeling [8] Prim’s Minimum Spanning Tree [0] Quit When option 1 is selected, an adjacency matrix for the graph should be displayed, where the ( i , j ) entry is the weight on the i to j directed edge. When option 2 is selected the transitive closure matrix for the weighted graph should be displayed. When option 3 is selected, the user should be prompted for the search keys for the source and destination vertices. The program should display the shortest path from the source to the destination, showing intermediate cites and distances. If no such path exists, the program should indicate. Options 4 and 5 display the orders in which the graph is traversed. Option 6 allows you to calculate the number of edges. When option 7 is selected, the program should perform a topological sort of the graph showing the labeling generated by the sort. When option 8 is selected, it should display the complete path between any pair of vertices in the graph if such a path exists or display an appropriate message indication that no such path exists. If such a path exists, the total cost of the path should be displayed.
Project Task: Run the given menu-driven graph application for a given input data about cities and interlinks to answer the following questions.