update the graham algorithm