結果 : how to detect cycles in a undirected graph