Simple python3 solution
Complexity\n- Time complexity: O(m + n^2 \cdot \log(n))\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(m)\n Add your space complexity here
# Complexity\n- Time complexity: $$O(m + n^2 \\cdot \\log(n))$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(m)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\nwhere `m = edges.length`\n\n# Code\n``` python3 []\nimport heapq\n\nclass Solution:\n    def maxStarSum(self, vals: List[int], edges: List[List[int]], k: int) -> int:\n        vs = defaultdict(list)\n        for u, v in edges:\n            if vals[v] > 0:\n                vs[u].append(vals[v])\n            if vals[u] > 0:\n                vs[v].append(vals[u])\n        \n        return max(\n            value + sum(heapq.nlargest(k, vs[u]))\n            for u, value in enumerate(vals)\n        )\n\n```
['Hash Table', 'Greedy', 'Graph', 'Heap (Priority Queue)', 'Python3']