[Python] just get max from sorted values for each node
python\nclass Solution:\n    def maxStarSum(self, vals: List[int], edges: List[List[int]], k: int) -> int:\n        g = defaultdict(list)\n        \n        # g
```python\nclass Solution:\n    def maxStarSum(self, vals: List[int], edges: List[List[int]], k: int) -> int:\n        g = defaultdict(list)\n        \n        # graph with neighbors values, but ignore negative values\n        for a, b in edges:\n            if vals[b] > 0:\n                g[a].append(vals[b])\n            if vals[a] > 0:\n                g[b].append(vals[a])\n        \n        res = max(vals)\n\n        # find max sum of sorted values for each `start`\n        for n, v in g.items():\n            res = max(res, (vals[n] + sum(sorted(v, reverse=True)[:k])))\n\n        return res\n```
[]