optimization: take school courses efficiently

I want a design algorithm that allows a student to take important courses quickly until graduation. no time, room number, teachers are needed here. Only my selected courses that I know will allow me to graduate, but the best way to take them based on the prerequisites.

any suggestions and how to do it. Trees, graphic adjacency list