[prev] 29 [next]

  1. Only one connected component is checked.
  2. The loop

      for each (v,w)∈edges(G) do
    

    should exclude the neighbour of v from which you just came, so as to prevent a single edge w-v from being classified as a cycle.