Python DFS solution
Python DFS solution\n\n\t\tN = len(isConnected)\n        visited = [False] * N\n        \n        conn = defaultdict(list)\n        for i in range(N):\n        
Python DFS solution\n\n\t\tN = len(isConnected)\n        visited = [False] * N\n        \n        conn = defaultdict(list)\n        for i in range(N):\n            for j in range(N):\n                if i != j:\n                    if isConnected[i][j] == 1:\n                        conn[i].append(j)\n        \n        def dfs(i):\n            for j in conn[i]:\n                if visited[j] == False:\n                    visited[j] = True\n                    dfs(j)\n        \n        nprov = 0\n        for i in range(N):\n            if visited[i] == False:\n                visited[i] = True\n                nprov += 1\n                dfs(i)\n        \n        return nprov
[]