Comp 2673
Spring 2003
Examples of graph files for Project 2

Here are some examples of data files for graphs, as described in the project 2 assignment. These files do not completely test your program, so make sure you create some test files of your own. You might want to ask others if you can borrow their test files, as well.

Here's a graph that has 20 nodes, all connected in a line, the edges each having weight 1. Note that the distance from vertex i to vertex j should come out to be |i-j|. linear.grf

Here's a complete graph with 30 nodes. In other words, there is an edge between every pair of nodes (question: how many edges are there in a complete graph with n nodes?) It was created by randomly placing 30 points in the square with corners (0, 0) and (1, 1), then creating an edge between each pair of points, the weight of which is the distance between the points (question: what is the theoretical maximum edge weight?). The shortest path between any two vertices should be the single edge connecting the two vertices. You can look up this weight directly in the file. complete30.grf

Here's a tree. The root node is node number 1. It has a fan-out of 5, and has 3 levels of nodes. The weight of the first level of edges is 1, the weight of the 2nd level is 2. Note that there is only one path from any vertex to any other. tree5-2.grf

Here's a tree. The root node is node number 1. It has a fan-out of 3, and has 8 levels of nodes. The weight of the first level of edges is 1, the weight of the 2nd level is 2, the weight of the 3rd is 4, etc. Note that there is only one path from any vertex to any other. What is the length of the path from vertex n to vertex m? You'll have to answer this question to be able to test this file. tree3-8.grf

Here's a file in which the number of edges does not match the number of edge lines in the file. Your program should detect this error.
bad1.grf

Here's a file in which one of the edges has a negative weight. Your program should etect this error.
bad2.grf

The examples given above just begin to test your program. Notice that in each of the examples, there is only ONE path between any two vertices. Thus, a huge part of your algorithm has not been tested at all. You must make test files to do this. Also, you have not been given examples of disconnected graphs, so you must make a test file that shows that your program can detect that no path exists between two vertices. Also, there are several other possible errors in the graph files that you should check for.

In future CS courses, you should expect to have to make all of your own test files. Testing a program thoroughly is part of programming, and it requires care and attention.