[C++] No Priority_queue ,just use nbrs as values
Approach\nNo Priority_queue ,just use nbr as values\n# Code\n\nclass Solution {\npublic:\n   int maxStarSum(vector<int>& vals, vector<vector<int>>& edges, int k
# Approach\nNo Priority_queue ,just use nbr as values\n# Code\n```\nclass Solution {\npublic:\n   int maxStarSum(vector<int>& vals, vector<vector<int>>& edges, int k) {\n       int res = INT_MIN;\n       vector<vector<int>> graph(vals.size(), vector<int>());\n       \n       for(auto edge : edges) {\n           int u = edge[0];\n           int v = edge[1];\n           \n           graph[u].push_back(vals[v]);\n           graph[v].push_back(vals[u]);\n       }\n       for(auto &e:graph)\n           {\n               sort(e.begin(),e.end(),greater<int>());\n           }\n        //    for(auto e:graph)\n        //    {\n        //        for(auto f:e)\n        //        {\n        //            cout<<f<<" ";\n        //        }\n        //        cout<<endl;\n        //    }\n       for(int i=0; i<vals.size(); i++) {\n           \n           int cur=0;\n           int temp=k;\n           for(auto e:graph[i])\n           {\n               if(e>0 && temp>0)\n               {\n                   cur+=e;\n                   temp--;\n               }\n               else\n               {\n                   break;\n               }\n           }\n           res = max(res, cur+vals[i]);\n       }\n       \n       return res;\n   }\n};\n```\nthanks!
['Heap (Priority Queue)', 'C++']