I am trying to find all the cycles in an undirected graph given the adjacency list of the vertices, with the an output of all the cycles in form of the vertices they are made up of.
For example -http://i.stack.imgur.com/Ku4fd.jpg
The example depicts the graph drawn by the adjacency list with desired cycles result
1 235 2 134 3 1245 4 235 5 134
The output from the algorithm would be
Cycles: 1 2 3 1 3 5 2 3 4 3 4 5
Note that I am not trying to find ALL possible cycles in the graph but rather all the loops. We assume for this problem that there any vertex is connected to at least 2 others
I am new to discrete maths, algorithms and graph theory, any help would be greatly appreciated.