def determine_priority
pass = 1
change = 1
$max_priority = 0
while pass == 1 do
change = 0
$eq_dep_data.each_key {|id|
$eq_dep_data[id].rhs_dat.each_key {|id2|
if $eq_dep_data[id].degree.to_i + $eq_dep_data[id].priority.to_i < $eq_dep_data[id].rhs_dat_val(id2).to_i + $eq_dep_data[id2].priority.to_i + 1
if pass == 1 then
$eq_dep_data[id].priority = $eq_dep_data[id].rhs_dat_val(id2).to_i - $eq_dep_data[id].degree.to_i + $eq_dep_data[id2].priority.to_i + 1
if $eq_dep_data[id].priority > $max_priority then
$max_priority = $eq_dep_data[id].priority
end
change = 1
end
end
if $eq_dep_data[id].priority > 9999 then
puts "Inconsistent dependencies"
$stderr.puts "Inconsistent dependencies"
exit 1
end
}
}
if change == 0 then
if pass > 0 then
return
end
pass += 1
else
pass = 0
end
end
end