Given an undirected graph with n nodes and a list of edges, determine whether it contains any cycle, using a BFS-based approach. Return true or false. The input is JSON {n, edges}.
Input: JSON {n, edges}.
Output: Boolean — true or false.
Input: {"n":4,"edges":[[0,1],[1,2],[2,0]]}
Output: true
Explanation: Triangle is a cycle.Input: {"n":4,"edges":[[0,1],[1,2]]}
Output: false
Explanation: A tree has no cycle.Input: {"n":5,"edges":[[0,1],[1,2],[3,4]]}
Output: false
Explanation: A forest has no cycle.1<=n<=10^5undirected