graph question : cycle detection - undirected graph