Lab 8 CS2402 Spring 2009: Weighted Graphs and Travelling Salesman Problem - Prof. Olac Fue, Lab Reports of Data Structures and Algorithms

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

Pre 2010

Uploaded on 08/18/2009

koofers-user-vn0
koofers-user-vn0 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
CS2402
Spring 2009
Lab 8
Weighted Graphs
Due Friday, April 30, 2009
Instructions
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)

Partial preview of the text

Download Lab 8 CS2402 Spring 2009: Weighted Graphs and Travelling Salesman Problem - Prof. Olac Fue and more Lab Reports Data Structures and Algorithms in PDF only on Docsity!

CS

Spring 2009

Lab 8

Weighted Graphs

Due Friday, April 30, 2009

Instructions

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)