CS600 Project
CS 600 Project
Deadline: October 28
Tasks
1. Design an algorithm to answer the following question:
Is there a cycle which visits all the vertices of a given undirected graph exactly once ?
DO NOT give a pseudo-code. Describe your algorithm in English in
200 words or less.
(25 points)
2. Analyze the worst-case time of your algorithm ? (25 points)
3. Can you improve its worst-case time significantly (such as from polynomial to log,
or from exponential to polynomial etc.) ? If yes, how ? If no, why ? (25 points)
4. Implement your algorithm (1. or 3.), run it on randomly generated graphs
of from 50 to 200 (step 10) vertices and plot the worst case execution time of 30 random graphs
for each number of vertices.
The code for cycle-finding must be separated from the random graph generator code
so that it can be checked separately.
(25 points)
The input format for the program is as follows:
The number of vertices ;
the adjacency lists of the vertices separated by semicolons.
An adjacency list of a vertex, say v, is v followed by a colon
followed by a list of vertices
adjacent to v separated by commas.
The output is a sequence of vertices to be visited if such a cycle exists. Otherwise output 0.
For example, 4; 1:2,3,4; 2: 3,4; 3:4. represents an undirected graph
with four vertices, 1,2,3, and 4, and six edges, (1,2), (1,3), (1,4), (2,3),
(2,4), and
(3,4).
Note that the edge (1,2) for example is between vertices 1 and 2.
So it should be listed at vertex 2 as well as at vertex 1. But since the second listing
does not convey any new information, we list it once at vertex 1 and omit it at vertex 2.
Similarly for the other edges.
An output for this input can be the sequence 1,2,3,4,1 showing that the edges (1,2), (2,3),
(3,4), (4,1)
are traversed in that order to form a cycle satisfying the conditions.
Submit the following using the "submit toida" command:
A. Algorithm -- a text file
B. Answers to 2. and 3. above -- a text file
C. Source code for 4. above, with a Makefile, and
D. A graph showing the curve
for the worst case execution time against the number of vertices for 4. above.
EXCEL, jpg, gif and pdf files are accepted.
Due by the end of October 28, 2003.
You may discuss these questions among yourselves and/or with me.
But you must write the answers in your own words.