[Python] Simple detailed solution - beats 98%
Code\n\nclass Solution:\n    def maxStarSum(self, vals: List[int], edges: List[List[int]], k: int) -> int:\n        \n        #If there is only one value, then 
# Code\n```\nclass Solution:\n    def maxStarSum(self, vals: List[int], edges: List[List[int]], k: int) -> int:\n        \n        #If there is only one value, then it must be highest sum\n        if len(vals) == 1:\n            return vals[0]\n        \n        #Create adjacency List \n        #(dictionary where each key holds a list of all directly connected nodes)\n        graph = DefaultDict(list)\n        \n        #Populate adjacency list\n        for left,right in edges:\n            if vals[right] > 0: graph[left].append(vals[right]) \n            if vals[left] > 0: graph[right].append(vals[left]) \n\n        #Keep track of current largest. Initialize to largest value in vals\n        #to cover the cases where individual node is greater than any 2 or more node sums\n        largest = max(vals)\n\n        #Iterate through adjacency list and find which key has highest value after adding\n        #key\'s own value + sum of k-highest values for the key.\n        for key,values in graph.items():\n            subList = sorted(values, reverse = True)\n            largest = max(largest, sum(subList[0:k]) + vals[key])\n\n        return largest\n```
['Python3']