You should apply once your student sponsor has sent you your final course results and has notified the Home Office that you have successfully completed your course of study. You do not have to wait until you have graduated to apply.
If your visa expires after you have applied to the Graduate route, you will be permitted to remain in the UK whilst your application is being considered.