CS 112
Final Project
Due: Thursday,
Dec. 14
by 8:00 a.m.
5-10 Minute In-class presentation on Th Dec 14, 8:00-10:20.
The final project asks for the implementation in C++ of a
comprehesive set of graph connectivity functions. You will
"present" the project to me (Ileana) in the last day of
classes. I.e. you will run the program for me and show me its
various features, as well as be ready to answer any questions I
might have regarding the way it was done.
The program
builds on Homework 10 by reusing (and perhaps enhancing) the
following features:
- A menu-driven user interface. There should be an option for
each of the functions already implemented in Hw10, as well as for the new ones
described below.
- A Graph abstract data type implemented as a C++ class. In
fact, the implementation which you have already done
should be a directed graph.
To get a minimum passing grade on the project (C), you should submit at least
a complete solution to Hw10 (fully working and including
typescript showing thorough testing).
Building on this, and for increased final project grades, you will
include new features. Please add them incrementally, test them
thoroughly and be ready to submit the highest level version you
have completed, rather than attempting a complete program that
does not work at all. Remember that among the skills I am
testing you on with the final project are your improved software
engineering abilities, including the development and testing of
software, code reuse, documentation and readability for easy
maintenance.
The new features that you will have to implement now include:
- A function for performing DFS from a given vertex v. The
visited nodes should be printed on the standard output (screen)
as they are visited.
- A function which returns a list of all the nodes reachable from
a given node v.
- A function to decide if there exists a path from a given node v to
another node u in a directed graph.
- A function to decide if there exists a node
that cannot be reached from a node v, in a directed graph.
- In the main program, add an option to work with undirected
graphs, not just directed graphs.
Each time the user adds an edge from vertex a to vertex b,
the program automatically adds an edge from b to a.
The undirected graph should be implemented as a separate
class (called, for instance, UGraph). Although very similar, as a
data structure, to the directed case, it will have different
functions associated to it.
- The menu options should allow the user to work with either directed
or undirected graphs.
- The UGraph class should contain (besides the constructor,
read input, print and functions for adding nodes and edges)
at least the following
functions:
- A function to perform DFS on the graph. Each visited node is
printed on the standard output.
- A function to return a list of all the nodes reachable from a
given node in the graph.
- A function to decide if the
undirected graph is connected.
- So far, the data you could store in the nodes of a graph was
very simple, just two characters. At the top level of complexity
for this project, I am asking you to create a template class Graph,
which will allow you to store other types of data in a graph
node. The main program should allow you to create at least two
instances of this template class: one should be the previous
class Graph (with 2-characters per node as its associated data),
and the second with some other type of data (e.g. an integer
id number).
Roughly: a complete solution up to 4 is worth a B, a complete
solution up to 7 gives you an A-, and all the 8 points give you
an A. "Up to" means "up to and including".
"Complete" means everything: it compiles, it works, shows
sound programming style, it is
thoroughly tested, well documented, readable, nice
user-interface, clean typescript, and is submitted in time.
To submit:
- For the final project, submit all the relevant files (.cpp,
.h, Makefile and typescript with a comprehensive set of tests)
as:
submit Project files
- Print the typescript and next to each input test data,
draw (by hand) the corresponding graph, to make it easy
for me to interpret the results.
- Write on the typescript the level you have accomplished with
the project (e.g. "I implemented everything up to 7, but only
everything up to 7.2 works").
Ileana Streinu