Detecting Cycles In Undirected Graphs