Simple solution
Code\n\nclass Solution:\n    def maximalPathQuality(self, values: List[int], edges: List[List[int]], maxTime: int) -> int:\n        graph = defaultdict(list)\n 
# Code\n```\nclass Solution:\n    def maximalPathQuality(self, values: List[int], edges: List[List[int]], maxTime: int) -> int:\n        graph = defaultdict(list)\n        for node1, node2, time in edges:\n            graph[node1].append([node2, time])\n            graph[node2].append([node1, time])\n        result = 0\n        queue = deque()\n        queue.append([0, 0, 0, set()])\n        while queue:\n            node, currentTime, points, visited = queue.popleft()\n            if node not in visited:\n                points += values[node]\n                visited.add(node)\n            if node == 0:\n                result = max(result, points)\n            for neighbor, time in graph[node]:\n                if currentTime + time <= maxTime:\n                    queue.append([neighbor, currentTime + time, points, visited.copy()])\n        return result\n```
['Breadth-First Search', 'Python3']