✅Checkout my Simple BFS solution
\nclass Solution {\n    public int findCircleNum(int[][] pro) {\n        \n        boolean visited[]= new boolean[pro.length+1];\n        int count = 0;\n      
```\nclass Solution {\n    public int findCircleNum(int[][] pro) {\n        \n        boolean visited[]= new boolean[pro.length+1];\n        int count = 0;\n        for(int i=0;i < pro.length;++i){\n            if(visited[i]== false){\n                count++;\n                Queue<Integer>q = new LinkedList<>();\n                q.add(i);\n                visited[i]= true;                \n                while(!q.isEmpty()){\n                    Integer vertex = q.poll();                    \n                    for(int j=0;j<pro[0].length;++j){\n                        if(!visited[j] && pro[vertex][j]== 1){\n                            q.add(j);\n                            visited[j] = true;\n                        }\n                    }\n                }\n            }\n        }        \n        return count;\n    }\n}\n```
['Array', 'Breadth-First Search', 'Graph', 'Java']