3419. Minimize the Maximum Edge Weight of Graph
You are given two integers,
n
andthreshold
, as well as a directed weighted graph ofn
nodes numbered from 0 ton - 1
. The graph is represented by a 2D integer arrayedges
, whereedges[i] = [Ai, Bi, Wi]
indicates that there is an edge going from nodeAi
to nodeBi
with weightWi
.You have to remove some edges from this graph (possibly none), so that it satisfies the following conditions:
- Node 0 must be reachable from all other nodes.
- The maximum edge weight in the resulting graph is minimized.
- Each node has at most
threshold
outgoing edges.Return the minimum possible value of the maximum edge weight after removing the necessary edges. If it is impossible for all conditions to be satisfied, return -1.