Lab 1: Working with the Graph Class

Due Date: Tue 31 Oct, 23:59.


Background:

Lab 1 should be a refresher on implementing member functions and then using those member functions in a client program to perform certain actions. Once you're done, you will use the Intro-CS Assignment Dropoff form to hand in your finished program.


What You'll Need

Download the lab1.zip file from the 15-113 course web site. Save the zip file to your temp directory and unzip the files. You should see the following files:

Open the lab1.mcp file and look at the filenames listed inside. lab1.mcp is a CodeWarrior project file. The project file serves to manage the various libraries and source files that make up your program. More about this in Thursday's recitation.


Assignment

The degree of a vertex is the number of edges incident to that vertex. For a directed graph, we can define the following terms: You are to declare and implement member functions for each of the above. After doing so and testing your implementation, you are to implement the following client functions in graph-driver.cpp to exercise the 3 new member functions: To run your program, open a DOS window, cd into the directory where you're working and type the following command: 113.exe graph.txt. For the sample file, graph.txt, the correct answers are

Handing in your Solution

Your solution should be in the form of a .zip file. When we grade your solution we will unzip the folder and execute the project.

Your Solution zip file must contain (only) the following files

  1. lab1.mcp (the project)
  2. graph-adj.cpp
  3. graph-adj.h
  4. graph-driver.cpp
Do not include a copy of the datafile (graph.txt) or the matrix.h file as neither of these are changed.

Use the Intro Programming dropoff form to submit your zip file.