Beats 100% Python Simple Solution
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n    def maxStarSum(self, vals: List[int], edges: List[List[int]], k: int) -> int:\n        \n        graph = defaultdict(list)\n        \n        for src,dest in edges:\n            graph[src].append(dest)\n            graph[dest].append(src)\n            \n        #traverse each node and find value of edges and pick the highest two \n        maxi = float(\'-inf\')\n        if not edges:\n            return max(vals)\n        for node in graph:\n            temp = []\n            for val in graph[node]:\n                heapq.heappush(temp, vals[val])\n                while len(temp) > k:\n                    heapq.heappop(temp)\n            \n            tot = vals[node]\n            for i in range(len(temp)):\n                tot = max(tot, tot+ temp[i])\n                maxi = max(maxi,tot)\n        return maxi    \n            \n                \n        \n```
['Python3']