Docsity

Comparing Graph Implementations - Project 3 | CSC 8301, Study Guides, Projects, Research of Algorithms and Programming

Toggle sidebar
bg1
CSC 8301 Project 3: Comparing Graph Implementations, Summer 2004, Dr. Joyce
Goals: Perform an empirical comparison of the performance of two graph implementations
Points: 100
Due: July 20th at the beginning of class
General Description: You will create a program that uses the depth first search algorithm to determine if a graph has a
cycle. It will use both the adjacency matrix and adjacency list graph implementations. Your code will count the number
of accesses to the underlying data structures and the amount of computer time, required during the cycle discovery
process. You will run your program(s) on various sizes and densities of graphs and collect the resulting data. You will
analyze the data and create a report that presents your programs, data collected, and analysis. You may use whatever
language/system you prefer. You must place all source code files in the subdirectory csc8301/project3 of your
departmental UNIX account.
Depth First Search Approach: Similar to that described on page 163; initialize each vertex to “not visited”; mark as
“visited” the first time you visit; if you revisit a node during the dfs subroutine, you have discovered a cycle and can
stop.
The Implementations: Use both the adjacency matrix and adjacency list graph implementations (see page 29).
The Graphs:
Graph Sizes: Investigate graphs with N vertices where N = 10, 100, 200
Graph Densities: Create code that will randomly generate a graph. Given a probability p (0 <= p <= 1),
it will create a graph in which for each pair of vertices there is a probability p that there is an edge between
them. Note: we are using undirected graphs. Investigate probabilities p = 0.1, 0.5, 0.8
The Data Collected:
Number of Samples: For each "input" condition, collect data from ten runs of the algorithm, using a unique seed
for your random number generator for each run, and report and analyze the average of the results. But be sure to
use the same seeds "across" data representations.
Data Structure Counts: Count how many times the underlying data implementation is accessed. I’ll discuss this
further in class.
Execution Time: Determine the amount of computer time spent during the process. Do not include the time needed
to set up the initial graph. You may use whatever time units you think work best... maybe microseconds? Include a
short section in your report describing how you measured the execution time.
Report: Create a report, as you did for Projects 1 and 2. You can determine the format, order of information, and so on,
but be sure to include at least the following:
Heading and Introduction sections similar to that used in Project 1. The Introduction should include a
description of the general approach you used for the assignment.
Code listings
An explanation of how you measured execution time
A description of how you tested your code, perhaps with some sample output from test runs
An easy to read presentation of the data collected, perhaps using tables, or graphs, or both.
An Analysis section where you describe the results and report on any insights provided by the data, plus
whatever else you believe is appropriate/interesting.
A Question/Answer section where you try to answer the following questions. Note that you may have to revise
your program, or at least rerun it with other parameters, to complete this section. Describe the procedure you
followed.
oFor a graph with 100 vertices, what is the approximate value for p that results in a graph having a
cycle about 50% of the time?
oHow about 99% of the time?
oHow are the answers to the above questions affected if the number of nodes is increased/decreased?
A Conclusion

Partial preview of the text

Download Comparing Graph Implementations - Project 3 | CSC 8301 and more Study Guides, Projects, Research Algorithms and Programming in PDF only on Docsity!

CSC 8301 Project 3 : Comparing Graph Implementations, Summer 2004, Dr. Joyce Goals : Perform an empirical comparison of the performance of two graph implementations Points : 100 Due : July 20th^ at the beginning of class General Description : You will create a program that uses the depth first search algorithm to determine if a graph has a cycle. It will use both the adjacency matrix and adjacency list graph implementations. Your code will count the number of accesses to the underlying data structures and the amount of computer time, required during the cycle discovery process. You will run your program(s) on various sizes and densities of graphs and collect the resulting data. You will analyze the data and create a report that presents your programs, data collected, and analysis. You may use whatever language/system you prefer. You must place all source code files in the subdirectory csc8301/project3 of your departmental UNIX account. Depth First Search Approach : Similar to that described on page 163; initialize each vertex to “not visited”; mark as “visited” the first time you visit; if you revisit a node during the dfs subroutine, you have discovered a cycle and can stop. The Implementations : Use both the adjacency matrix and adjacency list graph implementations (see page 29). The Graphs : Graph Sizes : Investigate graphs with N vertices where N = 10, 100, 200 Graph Densities : Create code that will randomly generate a graph. Given a probability p (0 <= p <= 1), it will create a graph in which for each pair of vertices there is a probability p that there is an edge between them. Note: we are using undirected graphs. Investigate probabilities p = 0.1, 0.5, 0. The Data Collected :  Number of Samples : For each "input" condition, collect data from ten runs of the algorithm, using a unique seed for your random number generator for each run, and report and analyze the average of the results. But be sure to use the same seeds "across" data representations.  Data Structure Counts : Count how many times the underlying data implementation is accessed. I’ll discuss this further in class.  Execution Time : Determine the amount of computer time spent during the process. Do not include the time needed to set up the initial graph. You may use whatever time units you think work best... maybe microseconds? Include a short section in your report describing how you measured the execution time. Report : Create a report, as you did for Projects 1 and 2. You can determine the format, order of information, and so on, but be sure to include at least the following:  Heading and Introduction sections similar to that used in Project 1. The Introduction should include a description of the general approach you used for the assignment.  Code listings  An explanation of how you measured execution time  A description of how you tested your code, perhaps with some sample output from test runs  An easy to read presentation of the data collected, perhaps using tables, or graphs, or both.  An Analysis section where you describe the results and report on any insights provided by the data, plus whatever else you believe is appropriate/interesting.  A Question/Answer section where you try to answer the following questions. Note that you may have to revise your program, or at least rerun it with other parameters, to complete this section. Describe the procedure you followed. o For a graph with 100 vertices, what is the approximate value for p that results in a graph having a cycle about 50% of the time? o How about 99% of the time? o How are the answers to the above questions affected if the number of nodes is increased/decreased?  A Conclusion