Update Kahn algorithm