C++ bfs
cpp []\nclass Solution {\npublic:\n    vector<vector<int>> g;\n    vector<int> init;\n    \n    int minMalwareSpread(vector<vector<int>>& graph, vector<int>& in
```cpp []\nclass Solution {\npublic:\n    vector<vector<int>> g;\n    vector<int> init;\n    \n    int minMalwareSpread(vector<vector<int>>& graph, vector<int>& initial) {\n        g = graph;\n        int ans = 0, largest = INT_MIN;\n        sort(initial.begin(), initial.end());\n        init = initial;\n        for (int i = 0; i < init.size(); ++i) {\n            int prev = init[i];\n            init[i] = -1;\n            int x = bfs(prev);\n            if (x > largest) {\n                largest = x;\n                ans = prev;\n            }\n            init[i] = prev;\n        }\n        return ans;       \n    }\n    \n    int bfs(int removed) {\n        queue<int> q;\n        vector<bool> visited(g.size(), false);\n        for (auto& n : init) {\n            if (n != -1 && n != removed) {\n                visited[n] = true;\n                q.push(n);\n            }\n        }\n        while (!q.empty()) {\n            int f = q.front();\n            q.pop();\n            for (int i = 0; i < g[f].size(); ++i) {\n                if (g[f][i] && !visited[i] && i != removed) {\n                    visited[i] = true;\n                    q.push(i);\n                }\n            }\n        }\n        int uninfected = 0;\n        for (auto b : visited) uninfected += !b;\n        return uninfected;\n    }\n};\n\n```
['C++']