Recent :

1. Exemptions from final exam

Anyone who has earned all 900 possible points so far can afford to get zero points on the final and would still get an A (not an A-) in the course. Such people can therefore afford not to show up for the final.

Extending this exemption a bit further, we will assume that anyone who has earned 875 or more points so far would easily get 25 points or more on the final and hence get an A for the course. Such people can therefore also afford not to take the final and still get an A.

Posted: Wednesday, April 30, 2003.

1. A sample final exam is posted. Also solutions.

Posted: Friday, April 25, 2003.

# Assignment 5: “GraphEditor+BFS”

Monday, March 31, 2003

Due: Friday, April 18, 2003

## Description

Write a program that lets the user read and edit graphs and compute breadth-first spanning trees.

## Details

### Implementation

Use the format below. The comments are not part of the files; they are added here only to provide explanations.

The graphs in this assignment are undirected.

Each node has a location.

4             // number of nodes
0 -200    0   // node 0 is at (x,y)=(-200,   0)
1    0  200   // node 1 is at (x,y)=(   0, 200)
2  300 -100   // node 2 is at (x,y)=( 300,-100)
3 -100 -300   // node 3 is at (x,y)=(-100,-300)
5             // number of edges
0 1           // there is an edge between node 0 and node 1
1 2           // there is an edge between node 1 and node 2
2 3           // there is an edge between node 2 and node 3
3 0           // there is an edge between node 3 and node 0
0 2           // there is an edge between node 0 and node 2

### Command line parameters

Allow the user to run the program either with or without parameters:
main
main -f graph.txt
The second version makes the program read a graph from the given file.

<number>: select a node
r    : read graph from a file
e    : add or delete the edge between
the last two selected nodes
spanning tree
q    : quit
Here is a suitable showMenu function.

The current graph always needs to show in a graphics window.

Compiles without warnings:  10
Clean design of classes:  10
Command-line parameters:  10
Drawing graphs:  10
Adding nodes:  10 [This is not required. Leave it out.]
Deleting nodes:  10 [This is not required. Leave it out.]