Finished schedule creation algorithm with a graph