
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!

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)