Write and test a function for the cycle-detection algorithm in Exercise.
Exercise
Determine whether a graph contains a cycle-that is, a path connecting some vertex to itself.
The response must be typed, single spaced, must be in times new roman font (size 12) and must follow the APA format.