First if statement is for the special case where max == min, otherwise it will return 1px due to error in the calculation. Second if (the else if) is for the normal calculation if the metrics data is available.
return 1px is for default edges width, representing no data has flowed there yet.