My question is concerned with DETECTING if there exists a cycle. I don't care where the cycle occurs but only if there exist a cycle. In particular, I am working on the implementation of a (maximally) spanning tree algorithm. I have sorted the edges in descending order and then I pick one edge at the time and put it in the set of the graph edges IFF it doesn't cause a cycle.
I have found out that for undirected graphs in only enough to check if no_of_edges > no_of_vertices - 1. Is this right? I am trying to find a case when this is not true bt I cannot. Of course this doesn't imply that this is correct.
Thanks