Choose e by the order of their weight, starting from vertex 0
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```python3 []
class Solution:
    def minMaxWeight(self, n: int, edges: List[List[int]], threshold: int) -> int:
        adj = [[] for _ in range(n)]
        for e in edges:
            adj[e[1]].append((e[2], e[1], e[0]))
        edge = [0] * n
        hp = []
        for e in adj[0]:
            heapq.heappush(hp, e)
        included = set()
        included.add(0)
        res = 0
        while hp:
            v, lst, nxt = heapq.heappop(hp)
            if nxt not in included and edge[nxt] < threshold:
                edge[nxt] += 1
                included.add(nxt)
                for e in adj[nxt]:
                    heapq.heappush(hp, e)
                res = max(res, v)
        return res if len(included) == n else -1
                


```
['Python3']