Detecting Cycles in Graphs
In this homework you will write a program to detect cycles in a graph.
What to do
- Cut and paste the program pieces from the file
Graph.hs to get started
including the definition for the type ArrayGraph
and code for creating grpahs as arrays, and programs
that manipulate graphs as starting points.
.
- Alter the functions that you have cut and pasted so that they
implement hasCycle as described above.
- Be sure and rename functions so that names of the altered functions describe
what the functions do. I will assign points according to how well
you name your functions.
- I suggest you work in stages, cutting and pasting only a few pieces of a time.
- Be sure and create test harnesses that test your code. Test it as
you proceed, so that you know each piece works, before you
alter new pieces that depend upon previously altered pieces,
- Create a main function that illustrates that your code works.
What to turn in.
- A file by containing the working code of hasCycle.
- Include your name (as the author of the program) on the very first line
- At least 3 graphs as described above.
- Be sure you include tests
- Uploaded the file to blackboard
- Due on final exam day Tuesday, December 8, 2009.
Back to the Daily Record.
Back to the class web-page.