
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Instructions for lab 8 of cs2402 spring 2009 course, focusing on weighted graphs and the travelling salesman problem (tsp). Students are required to write methods for reading a weighted undirected graph from a file, computing minimum spanning trees, and single source shortest paths using dijkstra's algorithm. Additionally, a method for solving tsp using backtracking and a stack is provided.
Typology: Lab Reports
1 / 1
This page cannot be seen from the preview
Don't miss anything!

Part I
Write the following methods related to graphs: a) A method to read a weighted undirected graph from a file (see example in appendix) and store it using adjacency list and adjacency matrix representations. b) Minimum spanning tree c) Single source shortest paths using Dijkstra’s algorithm
Part II
The Travelling Salesman Problem (TSP) consists of, given a list of cities and their pair wise distances, finding a shortest possible tour that visits each city exactly once. TSP can be modeled as a graph: the graph’s vertices correspond to cities, the graph’s edges correspond to connections between cities, and the weight of an edge is the corresponding connection’s distance. Write a method to solve TSP using backtracking and a stack
Appendix
Example graph file:
Vertices El Paso Ruidoso Las Cruces Edges (El Paso,Las Cruces,43) (Las Cruces,Ruidoso,120) (El Paso, Ruidoso,135)