Calculating the maximum of first ancestor of u and v
maxWei = Math . max ( maxWei , Math . max ( maxWeight [ v ] [ 0 ] , maxWeight [ u ] [ 0 ] ) ) ; document . write ( minWei + " " + maxWei + " " ) ; } }